1.0.4 • Published 5 months ago

@spanglersoftware/easydatepicker v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Easy Date Picker

The Easy Date Picker is an easy to use, versatile, and dynamic, unstyled, React based date picker/calendar component. The component only uses React and vanilla JS keeping it light and simple. i18N localization is supported for localized month and day names. The quick-start style guide can help in customizing your styles quickly. Visually, there is very little set in stone. The display is highly customizable through standard SASS/CSS stylings.

Component Demonstration

Installation

npm install @spanglersoftware/easydatepicker

Usage

import DatePicker from '@spanglersoftware/easydatepicker';
...
<DatePicker {props} />

Properties

PropertyRequired?TypeDefaultDescription
selectedDateNoDate/NULL/UNDEFINEDCurrent DateA Date representing which date is selected
isHoveredNobooleantrueWhen present/true the date picker will be absolutely positioned relative to where the component is added in the DOM. Positioning is handled in the component making css overrides difficult
selectionPreferenceNostring ('all' or 'month')'month'allselect any day displayed in the picker, even if it is not a day in the displayed monthmonthUsers can only select days in the month they belong to
addDayClassNameNoCallback: (date:Date) => string/NULL/UNDEFINEDNULLAllows the developer to add custom className attributes to each day cell displayed in the picker
addDayContentNoCallback:(date:Date) => ReactElement<any, any>/NULL/UNDEFINEDNULLAllows the developer to add custom content to each day cell displayed in the picker
onDateSelectedYesCallback:(date:Date) => voidA callback used to handle the event when a user selects a date from the picker
previousMonthButtonContentNoCallback:() => ReactElement<any, any>NULLA callback used to customize the previous month button in the picker's header
nextMonthButtonContentNoCallback:() => ReactElement<any, any>NULLA callback used to customize the next month button in the picker's header
localeNostring'en-US'The locale to use for i18n formatting of month/day of week names
isSingleMonthAdjustedNobooleanfalseWhen true the changing previous/next month will only change by 1, otherwise it will change based on the monthsDisplayed value
monthsDisplayedNonumber1The total number of months to display. The selected date is the first date and the picker will show all months following the current month if this value is greater than 0, limited to a maximum of 24 months. If a minDate/maxDate are provided, the display will be limited to only dates with those ranges
minDate*NoDateNULLA date representing the minimum date in the picker. This limits the display of the calendar days, available months to choose from, and available years to choose from
maxDate*NoDateNULLA date representing the maximum date in the picker. This limits the display of the calendar days, available months to choose from, and available years to choose from

If minDate/maxDate are not provided, the date picker will allow up to 40 years to choose from (20 past, 20 future), but the date picker will allow the user to go forward or backwards as much as they want with the previous/next month selectors

Stylings

The package provides mechanisms to integrate styling quickly and easily.

CSS

If you are not using SASS, the dist/css folder contains css stylesheets to apply styles through imports, or use the easy-date-picker-empty.css to build your own styles. All the classes (except for custom addons) are built into the file so you can design it as you see best

node_modules/@spanglersoftware/easydatepicker/dist/css/[file]

easy-date-picker-modern.css

A clean and simple look

easy-date-picker-classic.css

An older styling similar to JQuery datepickers

easy-date-picker-plain.css

A CSS structure for quick custom design

SASS

If your application is already using SASS, the prebuilt scss files can be used to quickly incorporate into your application.

@forward node_modules/@spanglersoftware/easydatepicker/dist/sass/[file];

easydatepicker_modern.scss

A clean and simple look

easydatepicker_classic.scss

An older styling similar to JQuery datepickers

easydatepicker.scss

A SASS structure for quick custom design

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago