@ohos-ports/flowbite-datepicker 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc.js +73 -0
- package/.stylelintrc +12 -0
- package/CHANGELOG.md +72 -0
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/demo/index.html +582 -0
- package/demo/live-demo.js +471 -0
- package/dist/DateRangePicker.cjs.js +2996 -0
- package/dist/DateRangePicker.esm.js +2994 -0
- package/dist/DateRangePicker.umd.js +3002 -0
- package/dist/Datepicker.cjs.js +2778 -0
- package/dist/Datepicker.esm.js +2776 -0
- package/dist/Datepicker.umd.js +2784 -0
- package/dist/css/datepicker-bs4.css +276 -0
- package/dist/css/datepicker-bs4.min.css +1 -0
- package/dist/css/datepicker-bs5.css +276 -0
- package/dist/css/datepicker-bs5.min.css +1 -0
- package/dist/css/datepicker-bulma.css +258 -0
- package/dist/css/datepicker-bulma.min.css +1 -0
- package/dist/css/datepicker-foundation.css +262 -0
- package/dist/css/datepicker-foundation.min.css +1 -0
- package/dist/css/datepicker.css +306 -0
- package/dist/css/datepicker.min.css +1403 -0
- package/dist/js/datepicker-full.js +2777 -0
- package/dist/js/datepicker-full.min.js +1 -0
- package/dist/js/datepicker.js +2569 -0
- package/dist/js/datepicker.min.js +1 -0
- package/dist/js/locales/ar-tn.js +15 -0
- package/dist/js/locales/ar.js +15 -0
- package/dist/js/locales/az.js +14 -0
- package/dist/js/locales/bg.js +14 -0
- package/dist/js/locales/bm.js +18 -0
- package/dist/js/locales/bn.js +19 -0
- package/dist/js/locales/br.js +18 -0
- package/dist/js/locales/bs.js +15 -0
- package/dist/js/locales/ca.js +18 -0
- package/dist/js/locales/cs.js +19 -0
- package/dist/js/locales/cy.js +14 -0
- package/dist/js/locales/da.js +19 -0
- package/dist/js/locales/de.js +18 -0
- package/dist/js/locales/el.js +16 -0
- package/dist/js/locales/en-AU.js +18 -0
- package/dist/js/locales/en-CA.js +18 -0
- package/dist/js/locales/en-GB.js +18 -0
- package/dist/js/locales/en-IE.js +17 -0
- package/dist/js/locales/en-NZ.js +17 -0
- package/dist/js/locales/en-ZA.js +17 -0
- package/dist/js/locales/eo.js +17 -0
- package/dist/js/locales/es.js +18 -0
- package/dist/js/locales/et.js +18 -0
- package/dist/js/locales/eu.js +18 -0
- package/dist/js/locales/fa.js +17 -0
- package/dist/js/locales/fi.js +17 -0
- package/dist/js/locales/fo.js +15 -0
- package/dist/js/locales/fr-CH.js +21 -0
- package/dist/js/locales/fr.js +18 -0
- package/dist/js/locales/gl.js +16 -0
- package/dist/js/locales/he.js +15 -0
- package/dist/js/locales/hi.js +18 -0
- package/dist/js/locales/hr.js +13 -0
- package/dist/js/locales/hu.js +18 -0
- package/dist/js/locales/hy.js +18 -0
- package/dist/js/locales/id.js +15 -0
- package/dist/js/locales/is.js +14 -0
- package/dist/js/locales/it-CH.js +20 -0
- package/dist/js/locales/it.js +18 -0
- package/dist/js/locales/ja.js +17 -0
- package/dist/js/locales/ka.js +17 -0
- package/dist/js/locales/kk.js +15 -0
- package/dist/js/locales/km.js +15 -0
- package/dist/js/locales/ko.js +18 -0
- package/dist/js/locales/lt.js +19 -0
- package/dist/js/locales/lv.js +18 -0
- package/dist/js/locales/me.js +17 -0
- package/dist/js/locales/mk.js +15 -0
- package/dist/js/locales/mn.js +17 -0
- package/dist/js/locales/mr.js +18 -0
- package/dist/js/locales/ms.js +15 -0
- package/dist/js/locales/nl-BE.js +18 -0
- package/dist/js/locales/nl.js +18 -0
- package/dist/js/locales/no.js +18 -0
- package/dist/js/locales/oc.js +17 -0
- package/dist/js/locales/pl.js +17 -0
- package/dist/js/locales/pt-BR.js +17 -0
- package/dist/js/locales/pt.js +18 -0
- package/dist/js/locales/ro.js +17 -0
- package/dist/js/locales/ru.js +18 -0
- package/dist/js/locales/si.js +18 -0
- package/dist/js/locales/sk.js +18 -0
- package/dist/js/locales/sl.js +15 -0
- package/dist/js/locales/sq.js +18 -0
- package/dist/js/locales/sr-latn.js +16 -0
- package/dist/js/locales/sr.js +16 -0
- package/dist/js/locales/sv.js +17 -0
- package/dist/js/locales/sw.js +15 -0
- package/dist/js/locales/ta.js +18 -0
- package/dist/js/locales/tg.js +19 -0
- package/dist/js/locales/th.js +14 -0
- package/dist/js/locales/tk.js +18 -0
- package/dist/js/locales/tr.js +17 -0
- package/dist/js/locales/uk.js +17 -0
- package/dist/js/locales/uz-cyrl.js +18 -0
- package/dist/js/locales/uz-latn.js +18 -0
- package/dist/js/locales/vi.js +16 -0
- package/dist/js/locales/zh-CN.js +19 -0
- package/dist/js/locales/zh-TW.js +18 -0
- package/dist/locales/index.cjs.js +1028 -0
- package/dist/locales/index.esm.js +1028 -0
- package/dist/main.cjs.js +2999 -0
- package/dist/main.esm.js +2994 -0
- package/dist/main.umd.js +3005 -0
- package/docs/.nojekyll +0 -0
- package/docs/README.md +266 -0
- package/docs/_sidebar.md +6 -0
- package/docs/api.md +284 -0
- package/docs/date-string+format.md +90 -0
- package/docs/i18n.md +99 -0
- package/docs/images/datepicker-inline.jpg +0 -0
- package/docs/images/datepicker.jpg +0 -0
- package/docs/images/multidate.jpg +0 -0
- package/docs/images/picker-structure.jpg +0 -0
- package/docs/images/rangepicker.jpg +0 -0
- package/docs/images/view-days.jpg +0 -0
- package/docs/images/view-decades.jpg +0 -0
- package/docs/images/view-months.jpg +0 -0
- package/docs/images/view-years.jpg +0 -0
- package/docs/index.html +26 -0
- package/docs/options.md +354 -0
- package/docs/overview.md +174 -0
- package/extras/twoDigitToFullYear/test/twoDigitToFullYear.js +58 -0
- package/extras/twoDigitToFullYear/twoDigitToFullYear.js +26 -0
- package/js/DateRangePicker.js +210 -0
- package/js/Datepicker.js +487 -0
- package/js/datepicker-full.js +5 -0
- package/js/events/functions.js +48 -0
- package/js/events/inputFieldListeners.js +206 -0
- package/js/events/otherListeners.js +15 -0
- package/js/events/pickerListeners.js +70 -0
- package/js/i18n/base-locales.js +13 -0
- package/js/i18n/locales/ar-tn.js +15 -0
- package/js/i18n/locales/ar.js +15 -0
- package/js/i18n/locales/az.js +14 -0
- package/js/i18n/locales/bg.js +14 -0
- package/js/i18n/locales/bm.js +18 -0
- package/js/i18n/locales/bn.js +19 -0
- package/js/i18n/locales/br.js +18 -0
- package/js/i18n/locales/bs.js +15 -0
- package/js/i18n/locales/ca.js +18 -0
- package/js/i18n/locales/cs.js +19 -0
- package/js/i18n/locales/cy.js +14 -0
- package/js/i18n/locales/da.js +19 -0
- package/js/i18n/locales/de.js +18 -0
- package/js/i18n/locales/el.js +16 -0
- package/js/i18n/locales/en-AU.js +18 -0
- package/js/i18n/locales/en-CA.js +18 -0
- package/js/i18n/locales/en-GB.js +18 -0
- package/js/i18n/locales/en-IE.js +17 -0
- package/js/i18n/locales/en-NZ.js +17 -0
- package/js/i18n/locales/en-ZA.js +17 -0
- package/js/i18n/locales/eo.js +17 -0
- package/js/i18n/locales/es.js +18 -0
- package/js/i18n/locales/et.js +18 -0
- package/js/i18n/locales/eu.js +18 -0
- package/js/i18n/locales/fa.js +17 -0
- package/js/i18n/locales/fi.js +17 -0
- package/js/i18n/locales/fo.js +15 -0
- package/js/i18n/locales/fr-CH.js +21 -0
- package/js/i18n/locales/fr.js +18 -0
- package/js/i18n/locales/gl.js +16 -0
- package/js/i18n/locales/he.js +15 -0
- package/js/i18n/locales/hi.js +18 -0
- package/js/i18n/locales/hr.js +13 -0
- package/js/i18n/locales/hu.js +18 -0
- package/js/i18n/locales/hy.js +18 -0
- package/js/i18n/locales/id.js +15 -0
- package/js/i18n/locales/is.js +14 -0
- package/js/i18n/locales/it-CH.js +20 -0
- package/js/i18n/locales/it.js +18 -0
- package/js/i18n/locales/ja.js +17 -0
- package/js/i18n/locales/ka.js +17 -0
- package/js/i18n/locales/kk.js +15 -0
- package/js/i18n/locales/km.js +15 -0
- package/js/i18n/locales/ko.js +18 -0
- package/js/i18n/locales/lt.js +19 -0
- package/js/i18n/locales/lv.js +18 -0
- package/js/i18n/locales/me.js +17 -0
- package/js/i18n/locales/mk.js +15 -0
- package/js/i18n/locales/mn.js +17 -0
- package/js/i18n/locales/mr.js +18 -0
- package/js/i18n/locales/ms.js +15 -0
- package/js/i18n/locales/nl-BE.js +18 -0
- package/js/i18n/locales/nl.js +18 -0
- package/js/i18n/locales/no.js +18 -0
- package/js/i18n/locales/oc.js +17 -0
- package/js/i18n/locales/pl.js +17 -0
- package/js/i18n/locales/pt-BR.js +17 -0
- package/js/i18n/locales/pt.js +18 -0
- package/js/i18n/locales/ro.js +17 -0
- package/js/i18n/locales/ru.js +18 -0
- package/js/i18n/locales/si.js +18 -0
- package/js/i18n/locales/sk.js +18 -0
- package/js/i18n/locales/sl.js +15 -0
- package/js/i18n/locales/sq.js +18 -0
- package/js/i18n/locales/sr-latn.js +16 -0
- package/js/i18n/locales/sr.js +16 -0
- package/js/i18n/locales/sv.js +17 -0
- package/js/i18n/locales/sw.js +15 -0
- package/js/i18n/locales/ta.js +18 -0
- package/js/i18n/locales/tg.js +19 -0
- package/js/i18n/locales/th.js +14 -0
- package/js/i18n/locales/tk.js +18 -0
- package/js/i18n/locales/tr.js +17 -0
- package/js/i18n/locales/uk.js +17 -0
- package/js/i18n/locales/uz-cyrl.js +18 -0
- package/js/i18n/locales/uz-latn.js +18 -0
- package/js/i18n/locales/vi.js +16 -0
- package/js/i18n/locales/zh-CN.js +19 -0
- package/js/i18n/locales/zh-TW.js +18 -0
- package/js/lib/date-format.js +185 -0
- package/js/lib/date.js +82 -0
- package/js/lib/dom.js +55 -0
- package/js/lib/event.js +68 -0
- package/js/lib/utils.js +61 -0
- package/js/main.js +4 -0
- package/js/options/defaultOptions.js +38 -0
- package/js/options/processOptions.js +263 -0
- package/js/picker/Picker.js +334 -0
- package/js/picker/templates/calendarWeeksTemplate.js +8 -0
- package/js/picker/templates/daysTemplate.js +8 -0
- package/js/picker/templates/pickerTemplate.js +23 -0
- package/js/picker/views/DaysView.js +250 -0
- package/js/picker/views/MonthsView.js +198 -0
- package/js/picker/views/View.js +55 -0
- package/js/picker/views/YearsView.js +170 -0
- package/package.json +81 -0
- package/postcss.config.js +5 -0
- package/rollup.config.js +75 -0
- package/sass/_mixins.scss +12 -0
- package/sass/datepicker-bs4.scss +91 -0
- package/sass/datepicker-bs5.scss +91 -0
- package/sass/datepicker-bulma.scss +69 -0
- package/sass/datepicker-foundation.scss +66 -0
- package/sass/datepicker.scss +436 -0
- package/sass/index-bs4.scss +5 -0
- package/sass/index-bs5.scss +5 -0
- package/sass/index-bulma.scss +6 -0
- package/sass/index-foundation.scss +3 -0
- package/scripts/build-css.js +39 -0
- package/scripts/build-locales.js +57 -0
- package/scripts/convert-bsdp-locales.js +65 -0
- package/scripts/minify-css.js +31 -0
- package/scripts/minify-js.js +17 -0
- package/style.css +10 -0
- package/tailwind.config.js +16 -0
- package/tailwind.css +1389 -0
- package/test/DateRangePicker/DateRangePicker.js +547 -0
- package/test/DateRangePicker/api-methods.js +415 -0
- package/test/DateRangePicker/date-selection.js +472 -0
- package/test/DateRangePicker/options.js +308 -0
- package/test/Datepicker/Datepicker-object.js +236 -0
- package/test/Datepicker/api-methods.js +328 -0
- package/test/_utils/date.js +102 -0
- package/test/_utils/dom.js +70 -0
- package/test/events.js +785 -0
- package/test/inline-mode.js +45 -0
- package/test/keyboard-operation/arrow-down.js +293 -0
- package/test/keyboard-operation/arrow-left.js +255 -0
- package/test/keyboard-operation/arrow-right.js +215 -0
- package/test/keyboard-operation/arrow-up.js +461 -0
- package/test/keyboard-operation/edit-mode.js +458 -0
- package/test/keyboard-operation/keyboard-operation.js +146 -0
- package/test/mouse-operation.js +580 -0
- package/test/options/before-show.js +635 -0
- package/test/options/bulma-datepicker.sublime-workspace +1280 -0
- package/test/options/buttons.js +383 -0
- package/test/options/date-restrictions.js +802 -0
- package/test/options/format.js +281 -0
- package/test/options/multidate.js +380 -0
- package/test/options/options.js +727 -0
- package/test/options/orientation.js +410 -0
- package/test/options/pick-levle+view.js +357 -0
- package/test/test.html +94 -0
- package/test/unit/DateRangePicker.js +192 -0
- package/test/unit/Datepicker.js +307 -0
- package/test/unit/_setup.js +28 -0
- package/test/unit/lib/date-format.js +310 -0
- package/test/unit/lib/date.js +211 -0
- package/test/unit/lib/dom.js +142 -0
- package/test/unit/lib/event.js +207 -0
- package/test/unit/lib/utils.js +135 -0
package/docs/.nojekyll
ADDED
|
File without changes
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Vanilla JS Datepicker
|
|
2
|
+
|
|
3
|
+
A vanilla JavaScript remake of [bootstrap-datepicker](https://github.com/uxsolutions/bootstrap-datepicker) for [Bulma](https://bulma.io) and other CSS frameworks
|
|
4
|
+
|
|
5
|
+
This package is written from scratch as ECMAScript modules/[Sass](https://sass-lang.com) stylesheets to reproduce similar usability to bootstrap-datepicker.
|
|
6
|
+
It can work either standalone or with CSS framework (e.g. [Bootstrap](https://getbootstrap.com), [Foundation](https://get.foundation)), but works best with [Bulma](https://bulma.io) as it's developed primarily for Bulma.
|
|
7
|
+
|
|
8
|
+
The package also includes pre-built js/css files for those who like to use it directly on browser.
|
|
9
|
+
|
|
10
|
+
##### Features
|
|
11
|
+
|
|
12
|
+
- Date picker (input-dropdown, inline), date range picker
|
|
13
|
+
- Keyboard operation support (navigation by arrow keys, editing on input field)
|
|
14
|
+
- i18n support (locales, CSS-based text direction detection)
|
|
15
|
+
- Easily customizable to adapt stylesheet for various CSS frameworks
|
|
16
|
+
- Dependency free
|
|
17
|
+
- Made for modern browsers — no IE support
|
|
18
|
+
- Lightweight (well, relatively…) — 33kB (minified, uncompressed)
|
|
19
|
+
|
|
20
|
+
##### Demo
|
|
21
|
+
|
|
22
|
+
[Live Online Demo](https://raw.githack.com/mymth/vanillajs-datepicker/v1.1.4/demo/)
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
Install the package using npm.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install --save-dev vanillajs-datepicker
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
##### Date picker
|
|
33
|
+
|
|
34
|
+
– **Input picker**
|
|
35
|
+
|
|
36
|
+
1. create a text input element.
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<input type="text" name="foo">
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. import the `Datepicker` module.
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
import Datepicker from 'path/to/node_modules/vanillajs-datepicker/js/Datepicker.js';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
_Or if you use a bundler that supports [pkg.module](https://github.com/rollup/rollup/wiki/pkg.module) (e.g. [Rollup](https://rollupjs.org/) with [node-resolve](https://github.com/rollup/plugins/tree/master/packages/node-resolve) plugin, [webpack](https://webpack.js.org/))_
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
import { Datepicker } from 'vanillajs-datepicker';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
_Or if your bundler supports [package entry points](https://nodejs.org/api/packages.html#packages_package_entry_points) (e.g. Rollup with node-resolve plugin v8.4+, webpack v5+), you can also do this._
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
import Datepicker from 'vanillajs-datepicker/Datepicker';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
3. call `Datepicker` constructor with the input element and, optionally, [config options](options).
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
const elem = document.querySelector('input[name="foo"]');
|
|
64
|
+
const datepicker = new Datepicker(elem, {
|
|
65
|
+
// ...options
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+

|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
– **Inline picker**
|
|
73
|
+
|
|
74
|
+
1. create a block element.
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<div id="foo" data-date="01/25/2020"></div>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
2. import the `Datepicker` module in the same way as Input picker.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
3. call `Datepicker` constructor with the block element and, optionally, [config options](options).
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
const elem = document.getElementById('foo');
|
|
87
|
+
const datepicker = new Datepicker(elem, {
|
|
88
|
+
// ...options
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+

|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
##### Date range picker
|
|
96
|
+
|
|
97
|
+
1. create a block element that contains 2 text input elements.
|
|
98
|
+
|
|
99
|
+
```html
|
|
100
|
+
<div id="foo">
|
|
101
|
+
<input type="text" name="start">
|
|
102
|
+
<span>to</span>
|
|
103
|
+
<input type="text" name="end">
|
|
104
|
+
</div>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
2. import the `DateRangePicker` module.
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
import DateRangePicker from 'path/to/node_modules/vanillajs-datepicker/js/DateRangePicker.js';
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
_Or if you use a bundler that supports [pkg.module](https://github.com/rollup/rollup/wiki/pkg.module) (e.g. [Rollup](https://rollupjs.org/) with [node-resolve](https://github.com/rollup/plugins/tree/master/packages/node-resolve) plugin, [webpack](https://webpack.js.org/))_
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
import { DateRangePicker } from 'vanillajs-datepicker';
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
_Or if your bundler supports [package entry points](https://nodejs.org/api/packages.html#packages_package_entry_points) (e.g. Rollup with node-resolve plugin v8.4+, webpack v5+), you can also do this._
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
import DateRangePicker from 'vanillajs-datepicker/DateRangePicker';
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
3. call `DateRangePicker` constructor with the block element and, optionally, [config options](options).
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
const elem = document.getElementById('foo');
|
|
129
|
+
const rangepicker = new DateRangePicker(elem, {
|
|
130
|
+
// ...options
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+

|
|
135
|
+
|
|
136
|
+
##### Stylesheet
|
|
137
|
+
|
|
138
|
+
1. import scss file.
|
|
139
|
+
|
|
140
|
+
```scss
|
|
141
|
+
@import 'path/to/node_modules/vanillajs-datepicker/sass/datepicker';
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Using with CSS framework
|
|
145
|
+
|
|
146
|
+
#### Bulma
|
|
147
|
+
|
|
148
|
+
1. import scss file for Bulma instead.
|
|
149
|
+
|
|
150
|
+
```scss
|
|
151
|
+
@import 'path/to/node_modules/vanillajs-datepicker/sass/datepicker-bulma';
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Bootstrap
|
|
155
|
+
|
|
156
|
+
1. use `buttonClass: 'btn'` option to call `Datepicker`/`DateRangePicker` constructor.
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
const datepicker = new Datepicker(elem, {
|
|
160
|
+
buttonClass: 'btn',
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
2. import scss file for Bootstrap instead.
|
|
165
|
+
|
|
166
|
+
```scss
|
|
167
|
+
@import 'path/to/node_modules/vanillajs-datepicker/sass/datepicker-bs4';
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Foundation
|
|
171
|
+
|
|
172
|
+
1. import scss file for Foundation instead.
|
|
173
|
+
|
|
174
|
+
```scss
|
|
175
|
+
@import 'path/to/node_modules/vanillajs-datepicker/sass/datepicker-foundation';
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### Other frameworks
|
|
179
|
+
|
|
180
|
+
1. If the framework uses a specific class for button elements, set it to the `buttonClass` option to call `Datepicker`/`DateRangePicker` constructor.
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
const datepicker = new Datepicker(elem, {
|
|
184
|
+
buttonClass: 'uk-button',
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
2. Copy the following template into your sass stylesheet, and edit the node_module path, the variables, button class and button style adjustments to match your environment.
|
|
189
|
+
|
|
190
|
+
```scss
|
|
191
|
+
/***
|
|
192
|
+
Copy the datepicker variables (the ones with `dp-` prefix and `!default` flag)
|
|
193
|
+
from `sass/Datepicker.scss` to here
|
|
194
|
+
Then, edit them using your framework's variables/values
|
|
195
|
+
e.g.:
|
|
196
|
+
$dp-background-color: $background !default;
|
|
197
|
+
$dp-border-color: $border !default;
|
|
198
|
+
...
|
|
199
|
+
***/
|
|
200
|
+
|
|
201
|
+
@import '../node_modules/vanillajs-datepicker/sass/mixins';
|
|
202
|
+
|
|
203
|
+
@mixin dp-button {
|
|
204
|
+
.button {
|
|
205
|
+
/***
|
|
206
|
+
Place style adjustment for date picker's buttons here, if needed
|
|
207
|
+
***/
|
|
208
|
+
|
|
209
|
+
.datepicker-header & {
|
|
210
|
+
@include dp-header-button-common;
|
|
211
|
+
|
|
212
|
+
/***
|
|
213
|
+
Place style adjustment specific to the header buttons here, if needed
|
|
214
|
+
***/
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.datepicker-footer & {
|
|
218
|
+
@include dp-footer-button-common;
|
|
219
|
+
|
|
220
|
+
/***
|
|
221
|
+
Place style adjustment specific to the footer buttons here, if needed
|
|
222
|
+
***/
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@import '../node_modules/vanillajs-datepicker/sass/datepicker';
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Using from Browser
|
|
231
|
+
|
|
232
|
+
1. From CDN, load css and js files.
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/css/datepicker.min.css">
|
|
236
|
+
|
|
237
|
+
...
|
|
238
|
+
|
|
239
|
+
<script src="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/js/datepicker-full.min.js"></script>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
_If you use Bulma, Bootstrap or Foundation, you can use the css for your framework instead._
|
|
243
|
+
|
|
244
|
+
```html
|
|
245
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/css/datepicker-bulma.min.css">
|
|
246
|
+
<!-- or -->
|
|
247
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/css/datepicker-bs4.min.css">
|
|
248
|
+
<!-- or -->
|
|
249
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/css/datepicker-foundation.min.css">
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
_And if don't need date range, you can use the datepicker-only version of js file._
|
|
253
|
+
|
|
254
|
+
```html
|
|
255
|
+
<script src="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.1.4/dist/js/datepicker.min.js"></script>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
2. Call `Datepicker`/`DateRangePicker` constructor in the same way as explained [above](?id=quick-start). (The classes are exposed to global scope.)
|
|
259
|
+
|
|
260
|
+
```javascript
|
|
261
|
+
const elem = document.querySelector('input[name="foo"]');
|
|
262
|
+
const datepicker = new Datepicker(elem, {
|
|
263
|
+
// ...options
|
|
264
|
+
});
|
|
265
|
+
```
|
|
266
|
+
|
package/docs/_sidebar.md
ADDED
package/docs/api.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
## Datepicker
|
|
4
|
+
|
|
5
|
+
### Static Properties
|
|
6
|
+
|
|
7
|
+
#### Datepicker.locales
|
|
8
|
+
- Type: `Object`
|
|
9
|
+
|
|
10
|
+
Installed locales in `[languageCode]: localeObject` format. `en`:_English (US)_ is pre-installed.
|
|
11
|
+
|
|
12
|
+
> See [i18n](i18n) for the details.
|
|
13
|
+
|
|
14
|
+
### Static Methods
|
|
15
|
+
|
|
16
|
+
#### Datepicker.formatDate()
|
|
17
|
+
|
|
18
|
+
Format a Date object or a time value using given format and language
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
Datepicker.formatDate( date , format [, lang ] )
|
|
22
|
+
```
|
|
23
|
+
- **Arguments:**
|
|
24
|
+
- `date`: {`Date`|`Number`} - Date or time value to format
|
|
25
|
+
- `format`: {`String`|`Object`} - Format string or object that contains `toDisplay()` custom formatter
|
|
26
|
+
See [Options ≻ format](options?id=format)
|
|
27
|
+
- [`lang`] : {`String`} - Language code for the locale to use
|
|
28
|
+
– Default: `'en'`
|
|
29
|
+
- **Return:**
|
|
30
|
+
- {`String`} - Formatted date
|
|
31
|
+
|
|
32
|
+
#### Datepicker.parseDate()
|
|
33
|
+
|
|
34
|
+
Parse date string (or Date/time value) using given format and language
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
Datepicker.parseDate( dateStr , format [, lang ] )
|
|
38
|
+
```
|
|
39
|
+
- **Arguments:**
|
|
40
|
+
- `dateStr`: {`String`|`Date`|`Number`} - Date string, Date object or time value to parse
|
|
41
|
+
- `format`: {`String`|`Object`} - Format string or object that contains `toValue()` custom parser
|
|
42
|
+
See [Options ≻ format](options?id=format)
|
|
43
|
+
- [`lang`] : {`String`} - Language code for the locale to use
|
|
44
|
+
– Default: `'en'`
|
|
45
|
+
- **Return:**
|
|
46
|
+
- {`Number`} - Time value of parsed date
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Instance Properties
|
|
50
|
+
|
|
51
|
+
#### datepicker.active
|
|
52
|
+
- Type: `Boolean`
|
|
53
|
+
|
|
54
|
+
Whether the picker element is shown
|
|
55
|
+
(Read-only)
|
|
56
|
+
|
|
57
|
+
#### datepicker.pickerElement
|
|
58
|
+
- Type: `HTMLDivElement`
|
|
59
|
+
|
|
60
|
+
DOM object of picker element
|
|
61
|
+
(Read-only)
|
|
62
|
+
|
|
63
|
+
#### datepicker.rangepicker
|
|
64
|
+
- Type: `DateRangePicker`
|
|
65
|
+
|
|
66
|
+
DateRangePicker instance that the datepicker belongs to
|
|
67
|
+
Only avalable when the datepicker is a part of date range picker
|
|
68
|
+
(Read-only)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Instance Methods
|
|
72
|
+
|
|
73
|
+
#### datepicker.destroy()
|
|
74
|
+
|
|
75
|
+
Destroy the Datepicker instance
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
datepicker.destroy()
|
|
79
|
+
```
|
|
80
|
+
- **Return:**
|
|
81
|
+
- {`Detepicker`} - The instance destroyed
|
|
82
|
+
|
|
83
|
+
#### datepicker.getDate()
|
|
84
|
+
|
|
85
|
+
Get selected date(s)
|
|
86
|
+
|
|
87
|
+
The method returns a Date object of selected date by default, and returns an array of selected dates in multidate mode. If format string is passed, it returns date string(s) formatted in given format.
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
datepicker.getDate( [ format ] )
|
|
91
|
+
```
|
|
92
|
+
- **Arguments:**
|
|
93
|
+
- [`format`] : {`String`} - Format string to stringify the date(s)
|
|
94
|
+
- **Return:**
|
|
95
|
+
- {`Date`|`String`} - Selected date (or `undefined` if none is selected)
|
|
96
|
+
- {`Date[]`|`String[]`} - Array of selected dates (or empty array if none is selected)
|
|
97
|
+
|
|
98
|
+
#### datepicker.hide()
|
|
99
|
+
|
|
100
|
+
Hide the picker element
|
|
101
|
+
Not available on inline picker
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
datepicker.hide()
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### datepicker.refresh()
|
|
108
|
+
|
|
109
|
+
Refresh the picker element and the associated input field
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
datepicker.refresh( [ target ], [ forceRender ] )
|
|
113
|
+
```
|
|
114
|
+
- **Arguments:**
|
|
115
|
+
- [`target`] : {`String`} - Target item when refreshing one item only. `'picker'` or `'input'`
|
|
116
|
+
- [`forceRender`] : {`Boolean`} - Whether to re-render the picker element regardless of its state instead of optimized refresh
|
|
117
|
+
– Default: `'false'`
|
|
118
|
+
|
|
119
|
+
#### datepicker.setDate()
|
|
120
|
+
|
|
121
|
+
Set selected date(s)
|
|
122
|
+
|
|
123
|
+
In multidate mode, you can pass multiple dates as a series of arguments or an array. (Since each date is parsed individually, the type of the dates doesn't have to be the same.)
|
|
124
|
+
The given dates are used to toggle the select status of each date. The number of selected dates is kept from exceeding the length set to `maxNumberOfDates`. See [Multidate Mode](overview?id=multidate-mode) for more details.
|
|
125
|
+
|
|
126
|
+
With `clear: true` option, the method can be used to clear the selection and to replace the selection instead of toggling in multidate mode. If the option is passed with no date arguments or an empty dates array, it works as "clear" (clear the selection then set nothing), and if the option is passed with new dates to select, it works as "replace" (clear the selection then set the given dates)
|
|
127
|
+
|
|
128
|
+
When `render: false` option is used, the method omits re-rendering the picker element. In this case, you need to call [`refresh()`](api?id=datepickerrefresh) method later in order for the picker element to reflect the changes. The input field is refreshed always regardless of this option.
|
|
129
|
+
|
|
130
|
+
When invalid (unparsable, repeated, disabled or out-of-range) dates are passed, the method ignores them and applies only valid ones. In the case that all the given dates are invalid, which is distinguished from passing no dates, the method considers it as an error and leaves the selection untouched.
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
datepicker.setDate( date1 [, date2 [, ... dateN ]][, options ] )
|
|
134
|
+
datepicker.setDate( dates [, options ] )
|
|
135
|
+
datepicker.setDate( [ options ] )
|
|
136
|
+
```
|
|
137
|
+
- **Arguments:**
|
|
138
|
+
- [`...dates`] : {...(`String`|`Date`|`Number`)|`Array`} - Date strings, Date objects, time values or mix of those for new selection
|
|
139
|
+
- [`options`] : {`Object`} - Function options:
|
|
140
|
+
- `clear`: {`Boolean`} - Whether to clear the existing selection
|
|
141
|
+
– Default: `false`
|
|
142
|
+
- `render`: {`Boolean`} - Whether to re-render the picker element
|
|
143
|
+
– Default: `true`
|
|
144
|
+
- `autohide`: {`Boolean`} - Whether to hide the picker element after re-render
|
|
145
|
+
Ignored when used with `render: false`
|
|
146
|
+
– Default: the value of `autohide` config option
|
|
147
|
+
|
|
148
|
+
#### datepicker.setOptions()
|
|
149
|
+
|
|
150
|
+
Set new values to the config options
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
datepicker.setOptions( options )
|
|
154
|
+
```
|
|
155
|
+
- **Arguments:**
|
|
156
|
+
- `options`: {`Object`} - Config options to update
|
|
157
|
+
|
|
158
|
+
#### datepicker.show()
|
|
159
|
+
|
|
160
|
+
Show the picker element
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
datepicker.show()
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### datepicker.update()
|
|
167
|
+
|
|
168
|
+
Update the selected date(s) with input field's value
|
|
169
|
+
Not available on inline picker
|
|
170
|
+
|
|
171
|
+
The input field will be refreshed with properly formatted date string.
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
datepicker.update( [ options ] )
|
|
175
|
+
```
|
|
176
|
+
- **Arguments:**
|
|
177
|
+
- [`options`] : {`Object`} - Function options:
|
|
178
|
+
- `autohide`: {`Boolean`} - Whether to hide the picker element after update
|
|
179
|
+
– Default: `false`
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
### Events
|
|
183
|
+
|
|
184
|
+
All Datepicker-event objects are `CustomEvent` instances and dispatched to the associated `<input>` element (for inline picker, the block element).
|
|
185
|
+
They include the following extra data in the `detail` property.
|
|
186
|
+
|
|
187
|
+
- `date`: {`Date`} - Selected date(s) (see [getDate()](api?id=datepickergetdate))
|
|
188
|
+
- `viewDate`: {`Date`} - Focused date
|
|
189
|
+
- `viewId`: {`Number`} - ID of the current view
|
|
190
|
+
- `datepicker`: {`Datepicker`} - Datepicker instance
|
|
191
|
+
|
|
192
|
+
#### changeDate
|
|
193
|
+
|
|
194
|
+
Fired when the selected dates are changed.
|
|
195
|
+
|
|
196
|
+
#### changeMonth
|
|
197
|
+
|
|
198
|
+
Fired when the focused date is changed to a different month's date.
|
|
199
|
+
|
|
200
|
+
#### changeView
|
|
201
|
+
|
|
202
|
+
Fired when the current view is changed.
|
|
203
|
+
|
|
204
|
+
#### changeYear
|
|
205
|
+
|
|
206
|
+
Fired when the focused date is changed to a different year's date.
|
|
207
|
+
|
|
208
|
+
#### hide
|
|
209
|
+
|
|
210
|
+
Fired when the date picker becomes hidden.
|
|
211
|
+
|
|
212
|
+
#### show
|
|
213
|
+
|
|
214
|
+
Fired when the date picker becomes visible.
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
## DateRangePicker
|
|
218
|
+
|
|
219
|
+
### Instance Properties
|
|
220
|
+
|
|
221
|
+
#### rangepicker.datepickers
|
|
222
|
+
- Type: `Array`
|
|
223
|
+
|
|
224
|
+
Array of associated Datepicker instances
|
|
225
|
+
(Read-only)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
### Instance Methods
|
|
229
|
+
|
|
230
|
+
#### rangepicker.destroy()
|
|
231
|
+
|
|
232
|
+
Destroy the DateRangePicker instance
|
|
233
|
+
|
|
234
|
+
```javascript
|
|
235
|
+
rangepicker.destroy()
|
|
236
|
+
```
|
|
237
|
+
- **Return:**
|
|
238
|
+
- {`DateRangePicker`} - The instance destroyed
|
|
239
|
+
|
|
240
|
+
#### rangepicker.getDates()
|
|
241
|
+
|
|
242
|
+
Get the start and end dates of the date-range
|
|
243
|
+
|
|
244
|
+
The method returns Date objects by default. If format string is passed, it returns date strings formatted in given format.
|
|
245
|
+
The result array always contains 2 items (start date/end date) and `undefined` is used for unselected side. (e.g. If none is selected, the result will be `[undefined, undefined]`. If only the end date is set when `allowOneSidedRange` config option is `true`, `[undefined, endDate]` will be returned.)
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
rangepicker.getDates( [ format ] )
|
|
249
|
+
```
|
|
250
|
+
- **Arguments:**
|
|
251
|
+
- [`format`] : {`String`} - Format string to stringify the dates
|
|
252
|
+
- **Return:**
|
|
253
|
+
- {`Date[]`|`String[]`} - Start and end dates
|
|
254
|
+
|
|
255
|
+
#### rangepicker.setDates()
|
|
256
|
+
|
|
257
|
+
Set the start and end dates of the date range
|
|
258
|
+
|
|
259
|
+
The method calls [`datepicker.setDate()`](api?id=datepickersetdate) internally using each of the arguments in start→end order.
|
|
260
|
+
|
|
261
|
+
When a `clear: true` option object is passed instead of a date, the method clears the date.
|
|
262
|
+
|
|
263
|
+
If an invalid date, the same date as the current one or an option object without `clear: true` is passed, the method considers that argument as an "ineffective" argument because calling [`datepicker.setDate()`](api?id=datepickersetdate) with those values makes no changes to the date selection.
|
|
264
|
+
|
|
265
|
+
When the [`allowOneSidedRange`](options?id=allowonesidedrange) config option is `false`, passing `{clear: true}` to clear the range works only when it is done to the last effective argument (in other words, passed to `rangeEnd` or to `rangeStart` along with ineffective `rangeEnd`). This is because when the date range is changed, it gets normalized based on the last change at the end of the changing process.
|
|
266
|
+
|
|
267
|
+
```javascript
|
|
268
|
+
rangepicker.setDates( rangeStart , rangeEnd )
|
|
269
|
+
```
|
|
270
|
+
- **Arguments:**
|
|
271
|
+
- `rangeStart` : {`Date`|`Number`|`String)`|`Object`} - Start date of the range or `{clear: true}` to clear the date
|
|
272
|
+
- `rangeEnd` : {`Date`|`Number`|`String)`|`Object`} - End date of the range or `{clear: true}` to clear the date
|
|
273
|
+
|
|
274
|
+
#### rangepicker.setOptions()
|
|
275
|
+
|
|
276
|
+
Set new values to the config options
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
rangepicker.setOptions( options )
|
|
280
|
+
```
|
|
281
|
+
- **Arguments:**
|
|
282
|
+
- `options`: {`Object`} - Config options to update
|
|
283
|
+
|
|
284
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Date String & Format
|
|
2
|
+
|
|
3
|
+
## Date format
|
|
4
|
+
|
|
5
|
+
Date format must be declared using the combination of the predefined tokens and separators.
|
|
6
|
+
|
|
7
|
+
**– Tokens:**
|
|
8
|
+
|
|
9
|
+
Token | Description | Example
|
|
10
|
+
--|--|--
|
|
11
|
+
`d` | day of the month without leading zero | 1, 2, ..., 31
|
|
12
|
+
`dd` | day of the month with leading zero | 01, 02, ..., 31
|
|
13
|
+
`D` | shortened day name of the week | Sum, Mon, ..., Sat
|
|
14
|
+
`DD` | full day name of the week | Sunday, Monday, ..., Saturday
|
|
15
|
+
`m` | numeric month without leading zero | 1, 2, ..., 12
|
|
16
|
+
`mm` | numeric month with leading zero | 01, 02, ..., 12
|
|
17
|
+
`M` | shortened month name | Jan, Feb, ..., Dec
|
|
18
|
+
`MM` | full month name | January, February, ..., December
|
|
19
|
+
`y` | year without leading zero | 1, 645, 1900, 2020
|
|
20
|
+
`yy` | 2-digit year with leading zero | 01, 45, 00, 20
|
|
21
|
+
`yyyy` | 4-digit year with leading zero | 0001, 0645, 1900, 2020
|
|
22
|
+
|
|
23
|
+
**– Separators:**
|
|
24
|
+
|
|
25
|
+
All printable ASCII characters other than numbers and alphabets, `年`, `月` and `日`
|
|
26
|
+
|
|
27
|
+
**Notes**
|
|
28
|
+
|
|
29
|
+
- Since the built-in parser extracts the parts of the date by splitting the string with the separators, formats without separators (e.g. `yyyymmdd`) are not supported.
|
|
30
|
+
- 2-digit year (`yy`) is only supported by the built-in formatter; the built-in parser doesn't.
|
|
31
|
+
|
|
32
|
+
> You can write your custom parser/formatter to handle arbitrary format including the above. See [`format` config option](options?id=format) for the details.
|
|
33
|
+
|
|
34
|
+
- Date format must not include the string set in the [`dateDelimiter`](options?id=datedelimiter) config option.
|
|
35
|
+
|
|
36
|
+
## Date string
|
|
37
|
+
|
|
38
|
+
Date strings are expected to be formatted in the date format set in the [`format`](options?id=format) config option (default: `mm/dd/yyyy`), but it isn't necessary to match the format strictly.
|
|
39
|
+
|
|
40
|
+
##### How Built-in Parser parses
|
|
41
|
+
|
|
42
|
+
The built-in parser uses the format string only to determine the sequence in which the date parts (year/month/day/day-of-the-week) and separators appear in the date string. The differences in separator characters, whether to have leading zeros and whether month name (full or short) or month number is used are ignored. Therefore, as long as the parts of a date string appear in the same order as the format's, the variations of the same date's date string are equally parsed to the same date.
|
|
43
|
+
|
|
44
|
+
There are some cases the parser treats the parts in specific way:
|
|
45
|
+
- year is treated as full year _(1-/2-digit years are not mapped to nearby century's)_
|
|
46
|
+
- month number not between 1 and 12 is treated in the similar way to [`Date.prototype.setMonth()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setMonth)
|
|
47
|
+
- month name is evaluated in case-insensitive begin-with match
|
|
48
|
+
- day not between 1 and last-day-of-the-month is treated in the same way as [`Date.prototype.setDate()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setDate)
|
|
49
|
+
- day-of-the-week is not evaluated _(not totally ignored, the existence is respected)_
|
|
50
|
+
- if a part is omitted from the format, missing in the date string or parsed unsuccessfully, current date's value is used to complement.
|
|
51
|
+
|
|
52
|
+
Here are some examples of how irregular date strings are parsed.
|
|
53
|
+
|
|
54
|
+
- Different separators from the format:
|
|
55
|
+
- if format is `yyyy-mm-dd`, `2020/04/22` ⟹ _April 22nd, 2020_
|
|
56
|
+
- if format is `m.d.y`, `1/15 (2018)` ⟹ _January 15th, 2018_
|
|
57
|
+
- With/without leading zeros:
|
|
58
|
+
- if format is `d/m/y`, `05/06/07` ⟹ _June 5th, 0007_
|
|
59
|
+
- if format is `yyyy-mm-dd`, `20-5-4` ⟹ _May 4th, 0020_
|
|
60
|
+
- Number for the month name:
|
|
61
|
+
- if format is `M-d-y`, `7-14-2020` ⟹ _July 14th, 2020_
|
|
62
|
+
- Incomplete month name/full name for short name:
|
|
63
|
+
- if format is `M-d-y`,
|
|
64
|
+
- `ap-22-2020` ⟹ _April 22nd, 2020_
|
|
65
|
+
- `sept-22-2020` ⟹ _September 22nd, 2020_
|
|
66
|
+
- `Ju-4-2020` ⟹ _June 4th, 2020_
|
|
67
|
+
- `July-4-2020` ⟹ _July 4th, 2020_
|
|
68
|
+
- Month/day outside the normal range:
|
|
69
|
+
- if format is `mm/dd/yyyy`,
|
|
70
|
+
- `14/31/2019` ⟹ _March 2nd, 2020_
|
|
71
|
+
- `0/0/2020` ⟹ _November 30th, 2019_
|
|
72
|
+
- Omitted/missing/invalid parts:
|
|
73
|
+
- if format is `mm/yyyy` and current date is _January 15th, 2020_,
|
|
74
|
+
- `04/2022` ⟹ _April 15th, 2022_
|
|
75
|
+
- if format is `m/d/y` and current date is _January 15th, 2020_,
|
|
76
|
+
- `4/22` ⟹ _April 22nd, 2020_
|
|
77
|
+
- `/22/2016` ⟹ _January 22nd, 2016_
|
|
78
|
+
- `7/xx/2016` ⟹ _July 15th, 2016_
|
|
79
|
+
- Day-of-the-week:
|
|
80
|
+
- if format is `D m/d y` and current date is _January 15th, 2020_,
|
|
81
|
+
- `xx 5/4 2022` ⟹ _May 4th, 2022_
|
|
82
|
+
- `5/4 2022` ⟹ _October 13th, 2025 (= April 2022nd, 2020)_
|
|
83
|
+
|
|
84
|
+
##### 'Today' shortcut
|
|
85
|
+
|
|
86
|
+
You can use `'today'` as a shortcut to the current date.
|
|
87
|
+
|
|
88
|
+
##### Multiple dates
|
|
89
|
+
|
|
90
|
+
You can combine multiple dates into a single date string by joining the dates with the delimiter set in the [dateDelimiter](options?id=datedelimiter) config option.
|