@vgorodkov/date-picker
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

Datepicker

A library to work with calendar

Installation

Install with npm

npm install @vgorodkov/date-picker

Usage/Examples

Datepicker service

import { DatepickerService, withHolidays, withTodos } from '@vgorodkov/date-picker';

function App() {
  const datepickerService = new DatepickerService();
  datepickerService.addDecorator(withTodos);
  datepickerService.addDecorator(withHolidays, [{ day: 3, month: 5, year: 2024 }]);
  const Datepicker = datepickerService.createDatepicker();

  return <Datepicker />;
}

Datepicker

import { Datepicker } from '@vgorodkov/date-picker';

function App() {
  const dateLimit = {
    max: { day: 1, month: 1, year: 2020 },
    min: { day: 1, month: 1, year: 2030 },
  };

  return (
    <Datepicker
      firstDayOfWeek="Su"
      showHolidays={false}
      calendarVariant="month"
      dateLimit={dateLimit}
    />
  );
}

Rangepicker

import { Rangepicker } from '@vgorodkov/date-picker';

function App() {
  const dateLimit = {
    max: { day: 1, month: 1, year: 2020 },
    min: { day: 1, month: 1, year: 2030 },
  };

  return (
    <Rangepicker
      firstDayOfWeek="Su"
      showHolidays={false}
      calendarVariant="month"
      dateLimit={dateLimit}
    />
  );
}

Rangepicker service

import { RangepickerService } from '@vgorodkov/date-picker';

function App() {
  const rangepickerService = new RangepickerService();
  const Rangepicker = rangepickerService.createRangepicker();

  return <Rangepicker />;
}

Readme

Keywords

Package Sidebar

Install

npm i @vgorodkov/date-picker

Weekly Downloads

1

Version

1.1.2

License

ISC

Unpacked Size

634 kB

Total Files

86

Last publish

Collaborators

  • vgorodkov