flatpickr-ce 4.10.0 → 4.12.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/README.md +72 -1
- package/dist/esm/index.js +220 -113
- package/dist/esm/l10n/af.js +68 -0
- package/dist/esm/l10n/ar-dz.js +2 -1
- package/dist/esm/l10n/ar-sy.js +50 -0
- package/dist/esm/l10n/ar.js +1 -0
- package/dist/esm/l10n/az.js +1 -0
- package/dist/esm/l10n/br.js +1 -0
- package/dist/esm/l10n/da.js +1 -0
- package/dist/esm/l10n/de.js +1 -0
- package/dist/esm/l10n/default.js +1 -0
- package/dist/esm/l10n/es.js +1 -0
- package/dist/esm/l10n/eu.js +65 -0
- package/dist/esm/l10n/fi.js +1 -0
- package/dist/esm/l10n/fr.js +1 -0
- package/dist/esm/l10n/gl.js +1 -0
- package/dist/esm/l10n/gr.js +2 -1
- package/dist/esm/l10n/hy.js +1 -0
- package/dist/esm/l10n/index.js +11 -0
- package/dist/esm/l10n/ja.js +1 -0
- package/dist/esm/l10n/ko.js +1 -0
- package/dist/esm/l10n/pl.js +1 -0
- package/dist/esm/l10n/pt.js +1 -0
- package/dist/esm/l10n/sq.js +1 -0
- package/dist/esm/l10n/sv.js +1 -0
- package/dist/esm/l10n/tk.js +80 -0
- package/dist/esm/l10n/uk.js +1 -0
- package/dist/esm/l10n/zh.js +2 -0
- package/dist/esm/l10n/zh_tw.js +1 -0
- package/dist/esm/plugins/momentPlugin.js +2 -2
- package/dist/esm/plugins/rangePlugin.js +18 -3
- package/dist/esm/plugins/scrollPlugin.js +3 -3
- package/dist/esm/plugins/weekSelect/weekSelect.js +1 -0
- package/dist/esm/utils/dates.js +37 -19
- package/dist/flatpickr.css +15 -1
- package/dist/flatpickr.js +377 -146
- package/dist/flatpickr.min.css +2 -2
- package/dist/flatpickr.min.js +2 -2
- package/dist/l10n/af.d.ts +84 -0
- package/dist/l10n/af.js +81 -0
- package/dist/l10n/ar-dz.d.ts +6 -0
- package/dist/l10n/ar-dz.js +2 -1
- package/dist/l10n/ar-sy.d.ts +84 -0
- package/dist/l10n/ar-sy.js +63 -0
- package/dist/l10n/ar.d.ts +6 -0
- package/dist/l10n/ar.js +1 -0
- package/dist/l10n/at.d.ts +6 -0
- package/dist/l10n/az.d.ts +6 -0
- package/dist/l10n/az.js +1 -0
- package/dist/l10n/be.d.ts +6 -0
- package/dist/l10n/bg.d.ts +6 -0
- package/dist/l10n/bn.d.ts +6 -0
- package/dist/l10n/br.d.ts +6 -0
- package/dist/l10n/br.js +1 -0
- package/dist/l10n/bs.d.ts +6 -0
- package/dist/l10n/cat.d.ts +6 -0
- package/dist/l10n/ckb.d.ts +6 -0
- package/dist/l10n/cs.d.ts +6 -0
- package/dist/l10n/cy.d.ts +6 -0
- package/dist/l10n/da.d.ts +6 -0
- package/dist/l10n/da.js +1 -0
- package/dist/l10n/de.d.ts +6 -0
- package/dist/l10n/de.js +1 -0
- package/dist/l10n/default.js +1 -0
- package/dist/l10n/eo.d.ts +6 -0
- package/dist/l10n/es.d.ts +6 -0
- package/dist/l10n/es.js +1 -0
- package/dist/l10n/et.d.ts +6 -0
- package/dist/l10n/eu.d.ts +84 -0
- package/dist/l10n/eu.js +78 -0
- package/dist/l10n/fa.d.ts +6 -0
- package/dist/l10n/fi.d.ts +6 -0
- package/dist/l10n/fi.js +1 -0
- package/dist/l10n/fo.d.ts +6 -0
- package/dist/l10n/fr.d.ts +6 -0
- package/dist/l10n/fr.js +1 -0
- package/dist/l10n/ga.d.ts +6 -0
- package/dist/l10n/gl.d.ts +6 -0
- package/dist/l10n/gl.js +1 -0
- package/dist/l10n/gr.d.ts +6 -0
- package/dist/l10n/gr.js +2 -1
- package/dist/l10n/he.d.ts +6 -0
- package/dist/l10n/hi.d.ts +6 -0
- package/dist/l10n/hr.d.ts +6 -0
- package/dist/l10n/hu.d.ts +6 -0
- package/dist/l10n/hy.d.ts +6 -0
- package/dist/l10n/hy.js +1 -0
- package/dist/l10n/id.d.ts +6 -0
- package/dist/l10n/index.js +542 -197
- package/dist/l10n/is.d.ts +6 -0
- package/dist/l10n/it.d.ts +6 -0
- package/dist/l10n/ja.d.ts +6 -0
- package/dist/l10n/ja.js +1 -0
- package/dist/l10n/ka.d.ts +6 -0
- package/dist/l10n/km.d.ts +6 -0
- package/dist/l10n/ko.d.ts +6 -0
- package/dist/l10n/ko.js +1 -0
- package/dist/l10n/kz.d.ts +6 -0
- package/dist/l10n/lt.d.ts +6 -0
- package/dist/l10n/lv.d.ts +6 -0
- package/dist/l10n/mk.d.ts +6 -0
- package/dist/l10n/mn.d.ts +6 -0
- package/dist/l10n/ms.d.ts +6 -0
- package/dist/l10n/my.d.ts +6 -0
- package/dist/l10n/nl.d.ts +6 -0
- package/dist/l10n/nn.d.ts +6 -0
- package/dist/l10n/no.d.ts +6 -0
- package/dist/l10n/pa.d.ts +6 -0
- package/dist/l10n/pl.d.ts +6 -0
- package/dist/l10n/pl.js +1 -0
- package/dist/l10n/pt.d.ts +6 -0
- package/dist/l10n/pt.js +1 -0
- package/dist/l10n/ro.d.ts +6 -0
- package/dist/l10n/ru.d.ts +6 -0
- package/dist/l10n/si.d.ts +6 -0
- package/dist/l10n/sk.d.ts +6 -0
- package/dist/l10n/sl.d.ts +6 -0
- package/dist/l10n/sq.d.ts +6 -0
- package/dist/l10n/sq.js +1 -0
- package/dist/l10n/sr-cyr.d.ts +6 -0
- package/dist/l10n/sr.d.ts +6 -0
- package/dist/l10n/sv.d.ts +6 -0
- package/dist/l10n/sv.js +1 -0
- package/dist/l10n/tg.d.ts +6 -0
- package/dist/l10n/th.d.ts +6 -0
- package/dist/l10n/tk.d.ts +84 -0
- package/dist/l10n/tk.js +93 -0
- package/dist/l10n/tr.d.ts +6 -0
- package/dist/l10n/uk.d.ts +6 -0
- package/dist/l10n/uk.js +1 -0
- package/dist/l10n/uz.d.ts +6 -0
- package/dist/l10n/uz_latn.d.ts +6 -0
- package/dist/l10n/vn.d.ts +6 -0
- package/dist/l10n/zh.d.ts +6 -0
- package/dist/l10n/zh.js +2 -0
- package/dist/l10n/zh_tw.d.ts +6 -0
- package/dist/l10n/zh_tw.js +1 -0
- package/dist/plugins/minMaxTimePlugin.js +3 -1
- package/dist/plugins/momentPlugin.js +2 -2
- package/dist/plugins/rangePlugin.js +27 -3
- package/dist/plugins/scrollPlugin.js +3 -3
- package/dist/plugins/weekSelect/weekSelect.js +2 -0
- package/dist/themes/airbnb.css +15 -1
- package/dist/themes/confetti.css +14 -0
- package/dist/themes/dark.css +14 -0
- package/dist/themes/light.css +14 -0
- package/dist/themes/material_blue.css +14 -0
- package/dist/themes/material_green.css +14 -0
- package/dist/themes/material_orange.css +14 -0
- package/dist/themes/material_red.css +14 -0
- package/dist/types/instance.d.ts +1 -0
- package/dist/types/locale.d.ts +3 -1
- package/package.json +6 -1
- package/src/style/flatpickr.styl +24 -1
package/README.md
CHANGED
|
@@ -42,6 +42,75 @@ npm install flatpickr@npm:flatpickr-ce
|
|
|
42
42
|
|
|
43
43
|
## What's changed since flatpickr 4.6.13
|
|
44
44
|
|
|
45
|
+
### 4.12.0
|
|
46
|
+
|
|
47
|
+
- With a `maxDate` given without a time, such as `"today"`, a `defaultDate`, a `setDate()` or a typed value at any time on that day is kept instead of dropped, and the native mobile input's `max` is that day's last minute ([#2460](https://github.com/flatpickr/flatpickr/issues/2460))
|
|
48
|
+
- With `static: true`, the calendar opens above the input for `position: "above"`, and with the automatic position when it doesn't fit below; `"right"` and `"center"` align it with the input's wrapper ([#2497](https://github.com/flatpickr/flatpickr/issues/2497), [#1847](https://github.com/flatpickr/flatpickr/issues/1847))
|
|
49
|
+
- With `enableTime`, `minTime` or `maxTime` and nothing selected, the time inputs show the default time held within them, the time a picked day gets, and AM/PM follows the hour shown ([#2547](https://github.com/flatpickr/flatpickr/issues/2547))
|
|
50
|
+
- A time input left holding no number, such as "7:13" typed in Firefox or one emptied with Delete, keeps the selected time instead of turning it to 12 AM or 00 ([#2498](https://github.com/flatpickr/flatpickr/issues/2498))
|
|
51
|
+
- A calendar with more than one month or with week numbers, created inside a hidden modal, tab or panel, is sized once it is shown instead of being squeezed to a few pixels ([#2579](https://github.com/flatpickr/flatpickr/issues/2579)); `set("showMonths", 1)` shrinks a calendar back to one month ([#2392](https://github.com/flatpickr/flatpickr/issues/2392))
|
|
52
|
+
- A hook given to `set()` in an object, such as `set({ onChange: fn })`, is called ([#2578](https://github.com/flatpickr/flatpickr/issues/2578))
|
|
53
|
+
- Picking a month in the month dropdown fires `onMonthChange` once instead of twice ([#2398](https://github.com/flatpickr/flatpickr/issues/2398)), and its options no longer carry a tabindex, which kept the dropdown from changing the month in Firefox 51 ([#2438](https://github.com/flatpickr/flatpickr/issues/2438))
|
|
54
|
+
- With rangePlugin and `inline: true`, a day picked on a range that has both ends starts a new range ([#2572](https://github.com/flatpickr/flatpickr/issues/2572)); with nothing selected, focusing the first input keeps the month the calendar shows instead of going to today's ([#2573](https://github.com/flatpickr/flatpickr/issues/2573))
|
|
55
|
+
- With `altInput`, the input shown takes the original input's `autocomplete` attribute, so `autocomplete="off"` works ([#2577](https://github.com/flatpickr/flatpickr/issues/2577))
|
|
56
|
+
- The wheel over a time input or the year no longer throws "CustomEvent is not a constructor" with `dist/plugins/scrollPlugin.js` ([#2510](https://github.com/flatpickr/flatpickr/pull/2510))
|
|
57
|
+
- With `wrap` and no `data-input` element inside, the error says so instead of being a TypeError ([#2404](https://github.com/flatpickr/flatpickr/pull/2404))
|
|
58
|
+
- The time inputs no longer carry `maxlength`, which number inputs don't allow, so pages with them pass HTML validation ([#2372](https://github.com/flatpickr/flatpickr/issues/2372))
|
|
59
|
+
|
|
60
|
+
Behavior changes to check when upgrading:
|
|
61
|
+
|
|
62
|
+
- A `maxDate` without a time, or with a midnight time such as `"2025-03-10 00:00"`, leaves its whole day open: `setDate()`, `defaultDate`, typed and preloaded values at any time that day are kept, `isEnabled(date, false)` returns true for them, and the native mobile input's `max` is `"2025-03-10T23:59:00"` (`23:59:59` with `enableSeconds`) instead of `"2025-03-10T00:00:00"`.
|
|
63
|
+
- A static calendar can open above the input. Pages that moved it there themselves, with rules on `.arrowBottom` such as a transform or a negative `margin-top`, should drop them; a page rule setting `top` on `.flatpickr-calendar.static` no longer applies while it is above. `positionElement` and the element passed to `open()` no longer affect a static calendar. flatpickr.css and the themes have the new `.static` rules; a stylesheet of your own built from an older one doesn't.
|
|
64
|
+
- With `enableTime` and nothing selected, the time inputs show the default time held within `minTime` and `maxTime`, also after `set("minTime")` or `set("maxTime")`. With a 12-hour clock, AM/PM follows the hour shown, so with a `maxDate` whose time is in the morning, a day other than `maxDate`'s gets that morning time instead of the same hour in the afternoon.
|
|
65
|
+
- A time input emptied and left keeps the selected time instead of setting it to 0; type 0 for 0. Left that way, it fires no `onChange`.
|
|
66
|
+
- With rangePlugin and `inline: true`, a day picked on a range that has both ends empties the second input until the next day completes the range, `onClose` fires only then, and with `enableTime` the new range starts at the default time. Calendars that aren't inline are unchanged.
|
|
67
|
+
- With rangePlugin and nothing selected, focusing the first input no longer moves the view, so `changeMonth()` and `jumpToDate()` called before opening hold, and a `minDate` or `maxDate` assigned to `fp.config` without `set()` no longer brings the view within it.
|
|
68
|
+
- `set({ onChange: fn })` replaces the hooks given before, including one a plugin added, as `set("onChange", fn)` does; a `null` hook in an object is kept as `[null]`.
|
|
69
|
+
- A month picked in the dropdown that `changeMonth()` refuses fires no `onMonthChange`.
|
|
70
|
+
- A calendar with more than one month or with week numbers that can't be measured has no inline width until it is laid out. An inline one gets its width in a ResizeObserver callback; a ResizeObserver of the page's own on an element whose size follows the calendar may then report "ResizeObserver loop completed with undelivered notifications" as an error event, which error trackers and Cypress see. Browsers without ResizeObserver (IE, Safari before 13.1) keep such a calendar at one month's width until `set("showMonths", ...)` is called once it is shown.
|
|
71
|
+
- `set("showMonths", 1)` removes the inline width of `.flatpickr-calendar` and `.flatpickr-days`, one the page wrote included.
|
|
72
|
+
- With `altInput`, an `autocomplete` that asks for autofill, such as `"bday"`, is on the input shown too.
|
|
73
|
+
- With `wrap` and no `data-input` element, `errorHandler` no longer gets "Invalid input element specified"; the error is logged with `console.error`.
|
|
74
|
+
- In IE9, typing in the time inputs is no longer cut at two digits; the value is still folded into two when the input is left.
|
|
75
|
+
|
|
76
|
+
### 4.11.0
|
|
77
|
+
|
|
78
|
+
- Closing the calendar after browsing to other months without picking a day no longer leaves it there: it reopens on the selected date ([#2835](https://github.com/flatpickr/flatpickr/issues/2835))
|
|
79
|
+
- The focus stays on the day just picked, so keyboard users keep their place in multiple mode, with `closeOnSelect: false` and with several months shown ([#2791](https://github.com/flatpickr/flatpickr/issues/2791))
|
|
80
|
+
- Picking a day that leaves the selection as it was no longer fires `onChange`, nor change and input on the input ([#2700](https://github.com/flatpickr/flatpickr/issues/2700))
|
|
81
|
+
- On touch screens, scrolling or zooming the page no longer closes the calendar; a tap outside closes it when the finger lifts ([#2680](https://github.com/flatpickr/flatpickr/issues/2680))
|
|
82
|
+
- `minDate`, `maxDate`, `enable` and `disable` strings with month or weekday names or AM/PM are read in the instance's locale ([#2721](https://github.com/flatpickr/flatpickr/issues/2721))
|
|
83
|
+
- A custom locale whose `weekdays` or `months` gives only `shorthand` or only `longhand` no longer throws; the other list is the default locale's ([#2654](https://github.com/flatpickr/flatpickr/issues/2654), [#2693](https://github.com/flatpickr/flatpickr/issues/2693))
|
|
84
|
+
- With rangePlugin and `enableTime`, a day picked anew for an end keeps that end's time, and the time inputs stay on it ([#2712](https://github.com/flatpickr/flatpickr/issues/2712))
|
|
85
|
+
- With `enableTime` and no date selected, `set("minDate")` and `set("maxDate")` put the default time on the time inputs ([#1869](https://github.com/flatpickr/flatpickr/issues/1869))
|
|
86
|
+
- `null` for `appendTo`, `formatDate` and `conjunction`, and `null` or `undefined` for `enable`, are taken as unset, as the docs list them ([#2725](https://github.com/flatpickr/flatpickr/issues/2725))
|
|
87
|
+
- The calendar is positioned by its full height, padding and border included ([#2628](https://github.com/flatpickr/flatpickr/issues/2628))
|
|
88
|
+
- With `showMonths` above 1, the days stay under their weekdays on a page whose `.hidden` rule sets `display: none`, as Tailwind's does ([#2822](https://github.com/flatpickr/flatpickr/issues/2822))
|
|
89
|
+
- In the default styles and the airbnb theme, the month dropdown's options are drawn on the calendar's background, so they stay readable when the browser's popup is dark ([#2629](https://github.com/flatpickr/flatpickr/issues/2629))
|
|
90
|
+
- The weekday labels carry no surrounding whitespace, so a page that preserves white-space shows the header aligned ([#2749](https://github.com/flatpickr/flatpickr/issues/2749))
|
|
91
|
+
- In Safari, an inline calendar no longer gets an arrow or a popup's positioning at init ([#2787](https://github.com/flatpickr/flatpickr/issues/2787), [#1377](https://github.com/flatpickr/flatpickr/issues/1377))
|
|
92
|
+
- weekSelect shows its calendar on mobile devices instead of failing to initialize ([#2824](https://github.com/flatpickr/flatpickr/issues/2824))
|
|
93
|
+
- The native mobile input's value is put on its step, so a date with seconds no longer keeps its form from submitting ([#2393](https://github.com/flatpickr/flatpickr/issues/2393)); it takes the original input's tabindex instead of 1 ([#2672](https://github.com/flatpickr/flatpickr/issues/2672)); `open()` opens its picker with `showPicker()` where the browser has it, as Firefox for Android needs ([#2726](https://github.com/flatpickr/flatpickr/issues/2726))
|
|
94
|
+
- With `enableSeconds`, the seconds input has an aria-label, the locale's new `secondAriaLabel` ([#2821](https://github.com/flatpickr/flatpickr/pull/2821))
|
|
95
|
+
- In IE, committing typed input, hovering a range and stepping a time input with momentPlugin no longer throw ([#2709](https://github.com/flatpickr/flatpickr/issues/2709))
|
|
96
|
+
- Locales: new Turkmen (`tk`), Basque (`eu`), Afrikaans (`af`) and Levantine Arabic (`ar_sy`); Greek is also registered as `el`, and Algerian Arabic as `ar_dz` instead of over `ar`; Mandarin writes AM and PM as 上午 and 下午, and Ukrainian ranges are separated with an em dash ([#2664](https://github.com/flatpickr/flatpickr/pull/2664), [#2706](https://github.com/flatpickr/flatpickr/pull/2706), [#2765](https://github.com/flatpickr/flatpickr/pull/2765), [#2774](https://github.com/flatpickr/flatpickr/pull/2774), [#2796](https://github.com/flatpickr/flatpickr/issues/2796), [#2830](https://github.com/flatpickr/flatpickr/pull/2830), [#2771](https://github.com/flatpickr/flatpickr/pull/2771), [#2826](https://github.com/flatpickr/flatpickr/pull/2826))
|
|
97
|
+
- The bug report template and the Contributing section link a JSFiddle that runs flatpickr-ce ([#2759](https://github.com/flatpickr/flatpickr/issues/2759))
|
|
98
|
+
|
|
99
|
+
Behavior changes to check when upgrading:
|
|
100
|
+
|
|
101
|
+
- Mandarin's AM/PM is 上午/下午, and in a value saved with AM or PM under a format with `K`, the AM or PM is skipped and the hour read as `h` gives it. Replace them in stored values, or keep them with `locale: { ...Mandarin, amPM: ["AM", "PM"] }`.
|
|
102
|
+
- Ukrainian ranges saved with " to " read as a same-day range of their first date, or a start alone with `enableTime`. Replace the separator in stored values, or keep it with `locale: { ...Ukrainian, rangeSeparator: " to " }`.
|
|
103
|
+
- With ar-dz.js loaded, `locale: "ar"` no longer gives Algerian Arabic; use `"ar_dz"`.
|
|
104
|
+
- Picking a day that leaves the selected dates and times as they were fires no `onChange`, change or input event, so plugins and handlers that act in `onChange` don't run for it; `onValueUpdate` still fires.
|
|
105
|
+
- On windows with touch and pointer events, a tap outside closes the calendar on `pointerup`, and a mouse there closes it on `pointerdown`. A page that keeps the calendar open by stopping `touchstart` or `mousedown` has to stop `pointerup` or `pointerdown` instead, or list the element in `ignoredFocusElements`.
|
|
106
|
+
- Closing after browsing away, with no selected date in view, moves the view back: the days are rebuilt, then `onYearChange` (when the year changes) and `onMonthChange` fire, before `onClose`.
|
|
107
|
+
- Without time inputs, the day picked takes the focus; in single mode with `closeOnSelect`, it holds it for a moment before the input does.
|
|
108
|
+
- With `enableTime` and no date selected, `set("minDate")` puts the default time on the time inputs instead of minDate's own time, so a picker whose `minDate` follows another picker's date no longer copies its time.
|
|
109
|
+
- With the native mobile input and `enableTime` but not `enableSeconds`, its value has no seconds. It gets `tabindex="0"` instead of `"1"`. Where `showPicker()` exists, `open()` no longer dispatches a click on it, and uses up the page's user activation.
|
|
110
|
+
- Weekday names in a custom locale are written as text, no longer parsed as HTML.
|
|
111
|
+
- An explicit `conjunction: undefined` joins dates with ", " instead of ",".
|
|
112
|
+
- TypeScript: the `Locale` type has a required `secondAriaLabel`; `CustomLocale` takes it as optional.
|
|
113
|
+
|
|
45
114
|
### 4.10.0
|
|
46
115
|
|
|
47
116
|
- The native mobile input follows `set("minDate")` and `set("maxDate")`, and its `min` and `max` are a date and time with `enableTime` and a time with `noCalendar`, on a time its picker can offer ([#2860](https://github.com/flatpickr/flatpickr/issues/2860))
|
|
@@ -170,13 +239,15 @@ Framework addons (they depend on the `flatpickr` package, so use the alias above
|
|
|
170
239
|
|
|
171
240
|
### Options are trusted
|
|
172
241
|
|
|
173
|
-
A few options are inserted into the calendar as HTML, not text: `prevArrow`, `nextArrow`, what `getWeek` returns
|
|
242
|
+
A few options are inserted into the calendar as HTML, not text: `prevArrow`, `nextArrow`, what `getWeek` returns and confirmDate's `confirmIcon`. Like the rest of the config, they are meant to come from your code: don't build them from user input or other untrusted data without escaping it.
|
|
174
243
|
|
|
175
244
|
|
|
176
245
|
## Contributing
|
|
177
246
|
|
|
178
247
|
Bug reports, triage and pull requests are all welcome. Fixes that are still open upstream can be reopened here.
|
|
179
248
|
|
|
249
|
+
To report a bug, start from [this fiddle](https://jsfiddle.net/gh/get/library/pure/colinli007/flatpickr-ce/tree/main/.github/repro), which loads the latest flatpickr-ce from jsDelivr: reproduce the bug there, save it and link it in the issue.
|
|
250
|
+
|
|
180
251
|
```sh
|
|
181
252
|
npm install
|
|
182
253
|
npm test # typecheck + unit tests
|