1.0.24 • Published 9 months ago

datepicker-p14 v1.0.24

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

JAVASCRIPT REACT node.js react


I - General information

This project is the conversion of a jQuery plugin datetimepicker into React component. The component can be installed as a npm package for a React application.


II - Install and use the DateTimePicker component

1. NPM install and Github page

  1. NPM
   npm install --save datepicker-p14
  1. Github Repository

Datepicker Github repository: github.com/KevinLeFaucheur/datetimepicker-react

2. Import

import DatePicker from 'datepicker-p14'
import 'datepicker-p14/dist/index.css'

3. JSX.

<DatePicker id='start-date' />

4. Getting the value.

   const [value, setValue] = useState();

 [...]
 
   <DatePicker onChange={(value) => setValue(value)} />

II - Examples

1. Locale Example

   <DatePicker options={ locale: 'fr' } />

2. Only TimePicker Example

   <DatePicker options={ timepicker: true, datepicker: false } />

3. Inline DatePicker Example

   <DatePicker options={ inline: true } />

4. allowTimes options TimePicker Example

   <DatePicker options={ timepicker: true, allowTimes: ['06:00','12:00','18:00'] } />

5. handler onChangeDateTime Example

   <DatePicker options={ onChangeDateTime: () => { } } />

6. minDate and maxDate Example

   <DatePicker options={ minDate: '08/01/2023', maxDate: '08/31/2023' } />

7. Dark Theme Example

   <DatePicker options={ theme: 'dark' } />

8. Highlighted Date Example

   highlightedPeriods: ['date, description, className'] }
   <DatePicker options={ highlightedDates: ['08/25/2023, Birthday, hlCyan'] } />

9. Highlighted Period Example

   highlightedPeriods: ['startdate, endDate, description, className'] }
   <DatePicker options={
			highlightedPeriods: ['09/01/2023, 09/30/2023, Practice, hlGreen'] }
/>

III - Full options list

Option NameDefault valueDescriptionExample
localeLanguage i18nSee table at the bottom{ locale: 'fr' }
formaty/m/d h:iFormat date{ format: 'y.d.m' }
step60timepicker steps, 0 < step <= 60{ step: 30 }
closeOnDateSelectfalseClose picker when choosing a date{ closeOnDateSelect: true }
validateOnBlurtrue{ validateOnBlur: false }
timepickerfalseEnable time picking{ timepicker: true }
datepickertrueEnable date picking{ datepicker: false }
weeksfalseShow week number, left side of calendar{ weeks: true }
theme''className for alternate color theme, dark is supported{ theme: 'dark' }
minDatefalseMinimum date enabled to pick{ minDate: 0 } { minDate: '08/15/2023' } { minDate: new Date() }
maxDatefalseMaximum date enbaled to pick{ maxDate: 0 } { maxDate: '08/15/2023' } { maxDate: new Date() }
startDatefalse{ startDate: '08/15/2023' }
defaultDatefalse{ defaultDate: '08/15/2023' }
defaultTimefalse{ defaultTime: '08/15/2023' }
minTimefalseMinimum time enabled to pick{ minTime: 0 } { minTime: '06:00' } { minTime: new Date() }
maxTimefalseMaximum time enabled to pick{ maxTime: 0 } { maxTime: '21:00' } { maxTime: new Date() }
allowTimes[]Timepicker will only display these if set{ allowTimes: ['06:00','12:00','18:00'] }
openedfalsePicker is opened by default when true{ opened: true }
inlinefalse{ inline: true }
todayButtontrueDisplay Today button shortcut{ todayButton: false }
timepickerScrollbartrueDisplay scroll bar for timepicker{timepickerScrollbar: false }
onSelectDate{ onSelectDate: () => { console.log('onSelectDate') } }
onChangeMonth{ onChangeMonth: () => { console.log('onChangeMonth') } }
onChangeYear{ onChangeYear: () => { console.log('onChangeYear') } }
onChangeDateTime{ onChangeDateTime: () => { console.log('onChangeDateTime') } }
onShow{ onShow: () => { console.log('onShow') } }
onClose{ onClose: () => { console.log('onClose') } }
inverseButtonfalseInverse month and time arrow buttons{ inverseButton: true }
scrollMonthtrueEnable mouse wheel for scrolling months{ scrollMonth: false }
scrollInputtrue{ scrollInput: false }
hours12false{ hours12: true }
yearStart1950Start value for year select{ yearStart: 1900 }
yearEnd2050End value for year select{ yearEnd: 2100 }
weekends[]{ weekends: ['08/15/2023','08/16/2023','08/17/2023','08/18/2023'] }
disabledDates[]Disable specific dates{ disabledDates: ['08/15/2023','08/16/2023','08/17/2023','08/18/2023'] }
allowDates[]{ allowDates: ['08/15/2023','08/16/2023','08/17/2023','08/18/2023'] }
disabledWeekDays[]Disable week days by index, Sun = 0, Sat = 6{ disabledWeekDays: [0,1,2] }

Language options

Language i18n
ar - Arabic
az - Azerbaijanian (Azeri)
bg - Bulgarian
bs - Bosanski
ca - Català
ch - Simplified Chinese
cs - Čeština
da - Dansk
de - German
el - Ελληνικά
en - English
en-GB - English (British)
es - Spanish
et - "Eesti"
eu - Euskara
fa - Persian
fi - Finnish (Suomi)
fr - French
gl - Galego
he - Hebrew (עברית)
hr - Hrvatski
hu - Hungarian
id - Indonesian
it - Italian
ja - Japanese
ko - Korean (한국어)
kr - Korean
lt - Lithuanian (lietuvių)
lv - Latvian (Latviešu)
mk - Macedonian (Македонски)
mn - Mongolian (Монгол)
nl - Dutch
no - Norwegian
pl - Polish
pt - Portuguese
pt-BR - Português(Brasil)
ro - Romanian
ru - Russian
se - Swedish
sk - Slovenčina
sl - Slovenščina
sq - Albanian (Shqip)
sr - Serbian Cyrillic (Српски)
sr-YU - Serbian (Srpski)
sv - Svenska
th - Thai
tr - Turkish
uk - Ukrainian
vi - Vietnamese
zh - Simplified Chinese (简体中文)
zh-TW - Traditional Chinese (繁體中文)
1.0.24

9 months ago

1.0.23

9 months ago

1.0.22

9 months ago

1.0.21

9 months ago

1.0.20

9 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

9 months ago

1.0.16

9 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago