Skip to content

Commit 1a54ee2

Browse files
committed
Merge branch 'v3'
2 parents bfb93ff + c324811 commit 1a54ee2

40 files changed

+699
-183
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.next
33
node_modules
44
package-lock.json
5+
coverage

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
### v3.5.0
4+
* added `fixedHeight` option, allows you to have equal weeks number in every month
5+
* added method `disableDate`, allows you to disabled one or multiple dates with datepicker API
6+
* added prop `disabledDates` - it is a Set which holds all disabled dates
7+
* added possibility to pass `{silent: true}` to `update` and `setCurrentView` methods, [#583](https://github.com/t1m0n/air-datepicker/issues/568)
8+
* changed `update` method - now if you pass `selectedDates` then calendar will keep selected only those dates
9+
* fixed selecting time on same date when `range: true`, [#568](https://github.com/t1m0n/air-datepicker/issues/568)
10+
* fixed date conversion to local date when using strings, e.g `selectDate('2024-03-05')` [#589](https://github.com/t1m0n/air-datepicker/issues/589)
11+
* fixed localization generation, thanks to [hreyeslo](https://github.com/hreyeslo) in [#524](https://github.com/t1m0n/air-datepicker/pull/524)
12+
* fixed type definition for `clear` method, thanks to [ahmetzambak](https://github.com/ahmetzambak) in [#591](https://github.com/t1m0n/air-datepicker/pull/591)
13+
* fixed German translation for "clear", thanks to [pbek](https://github.com/pbek) in [#582](https://github.com/t1m0n/air-datepicker/pull/582)
14+
* added Slovenian locale, thanks to [carliblaz](https://github.com/carliblaz) in [#569](https://github.com/t1m0n/air-datepicker/pull/569)
15+
* added Basque locale, thanks to [ikerib](https://github.com/ikerib) in [#529](https://github.com/t1m0n/air-datepicker/pull/529)
16+
* added Norwegian locale, thanks to [MortenSpjotvoll](https://github.com/MortenSpjotvoll) in [#521](https://github.com/t1m0n/air-datepicker/pull/521)
17+
318
### v3.4.0
419
* added new options `onFocus` and `onBeforeSelect` grant you more control over range selection behaviour and more [#526](https://github.com/t1m0n/air-datepicker/issues/526)
520
* added new method `getViewDates()` allows you to get all dates that should be currently displayed in calendar [#536](https://github.com/t1m0n/air-datepicker/issues/536)

README.md

+15-35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
> :tada: New version released! :tada:
2-
31
# Air Datepicker
42

53
Lightweight, **dependency-free**, fast, customizable datepicker written in pure JavaScript. Works in all modern browsers which supports native css variables.
@@ -26,6 +24,21 @@ new AirDatepicker('#el' [, options]);
2624

2725
## Recent updates
2826

27+
### v3.5.0
28+
* added `fixedHeight` option, allows you to have equal weeks number in every month
29+
* added method `disableDate`, allows you to disabled one or multiple dates with datepicker API
30+
* added prop `disabledDates` - it is a Set which holds all disabled dates
31+
* added possibility to pass `{silent: true}` to `update` and `setCurrentView` methods, [#583](https://github.com/t1m0n/air-datepicker/issues/568)
32+
* changed `update` method - now if you pass `selectedDates` then calendar will keep selected only those dates
33+
* fixed selecting time on same date when `range: true`, [#568](https://github.com/t1m0n/air-datepicker/issues/568)
34+
* fixed date conversion to local date when using strings, e.g `selectDate('2024-03-05')` [#589](https://github.com/t1m0n/air-datepicker/issues/589)
35+
* fixed localization generation, thanks to [hreyeslo](https://github.com/hreyeslo) in [#524](https://github.com/t1m0n/air-datepicker/pull/524)
36+
* fixed type definition for `clear` method, thanks to [ahmetzambak](https://github.com/ahmetzambak) in [#591](https://github.com/t1m0n/air-datepicker/pull/591)
37+
* fixed German translation for "clear", thanks to [pbek](https://github.com/pbek) in [#582](https://github.com/t1m0n/air-datepicker/pull/582)
38+
* added Slovenian locale, thanks to [carliblaz](https://github.com/carliblaz) in [#569](https://github.com/t1m0n/air-datepicker/pull/569)
39+
* added Basque locale, thanks to [ikerib](https://github.com/ikerib) in [#529](https://github.com/t1m0n/air-datepicker/pull/529)
40+
* added Norwegian locale, thanks to [MortenSpjotvoll](https://github.com/MortenSpjotvoll) in [#521](https://github.com/t1m0n/air-datepicker/pull/521)
41+
2942
### v3.4.0
3043
* added new options `onFocus` and `onBeforeSelect` grant you more control over range selection behaviour and more [#526](https://github.com/t1m0n/air-datepicker/issues/526)
3144
* added new method `getViewDates()` allows you to get all dates that should be currently displayed in calendar [#536](https://github.com/t1m0n/air-datepicker/issues/536)
@@ -39,39 +52,6 @@ new AirDatepicker('#el' [, options]);
3952
* added handling of optional chaining operator in dist package [#518](https://github.com/t1m0n/air-datepicker/issues/518)
4053
* added Indonesian locale, thanks to [BariqDharmawan](https://github.com/BariqDharmawan), in [#517](https://github.com/t1m0n/air-datepicker/pull/517)
4154

42-
### v3.3.4
43-
* recreate global container if it was removed from DOM [#516](https://github.com/t1m0n/air-datepicker/issues/516)
44-
* added Greek locale, thanks to [sonole](https://github.com/sonole), in [#515](https://github.com/t1m0n/air-datepicker/pull/515)
45-
46-
### v3.3.3
47-
* fixed time format in timepicker body [#512](https://github.com/t1m0n/air-datepicker/issues/512)
48-
49-
### v3.3.2
50-
* fixed day period value, when selecting date while datepicker is not active, [#510](https://github.com/t1m0n/air-datepicker/issues/510)
51-
* fixed German locale, [#511](https://github.com/t1m0n/air-datepicker/issues/511)
52-
53-
### v3.3.1
54-
* added Japanese locale, thanks to [kyong0612](https://github.com/kyong0612), in [#505](https://github.com/t1m0n/air-datepicker/pull/505)
55-
* added Korean locale, thanks to [YankeeTube](https://github.com/YankeeTube), in [#506](https://github.com/t1m0n/air-datepicker/pull/506)
56-
57-
### v3.3.0
58-
* new feature that allow you to add custom attributes via `onRenderCell` [#502](https://github.com/t1m0n/air-datepicker/issues/502), [read docs](https://air-datepicker.com/docs?scrollTo=onRenderCell)
59-
* fixed selecting cell when using custom html with `onRenderCell` option [#502](https://github.com/t1m0n/air-datepicker/issues/502)
60-
61-
### v3.2.1
62-
* added Arabic locale, thanks to [abdo-host](https://github.com/abdo-host) [#497](https://github.com/t1m0n/air-datepicker/pull/497)
63-
* added Italian locale, thanks to [msaltieri](https://github.com/msaltieri) [#498](https://github.com/t1m0n/air-datepicker/pull/498)
64-
65-
### v3.2.0
66-
* added `onClickDayName` option, [#459](https://github.com/t1m0n/air-datepicker/issues/459)
67-
* added `silent` param to `clear` method, [#477](https://github.com/t1m0n/air-datepicker/issues/477)
68-
* added Swedish locale, thanks to [naton](https://github.com/naton) [#207](https://github.com/t1m0n/air-datepicker/pull/207)
69-
* fixed error when trying to call `update` method with `view` parameter on hidden calendar, [#476](https://github.com/t1m0n/air-datepicker/issues/476)
70-
* fixed styles issue with time sliders, [#489](https://github.com/t1m0n/air-datepicker/issues/489)
71-
* fixed English docs description, [#490](https://github.com/t1m0n/air-datepicker/issues/490)
72-
* fixed typings for `formatDate` method, [#491](https://github.com/t1m0n/air-datepicker/issues/491)
73-
74-
7555
## Version 3.0.0 highlights
7656
It is been a while since the last release, a lot of work has been done, and I'm glad to finally present a new version of Air Datepicker.
7757

dist/README.md

+19-35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
> :tada: New version released! :tada:
2-
31
# Air Datepicker
42

53
Lightweight, **dependency-free**, fast, customizable datepicker written in pure JavaScript. Works in all modern browsers which supports native css variables.
@@ -26,43 +24,29 @@ new AirDatepicker('#el' [, options]);
2624

2725
## Recent updates
2826

27+
### v3.5.0
28+
* added `fixedHeight` option, allows you to have equal weeks number in every month
29+
* added method `disableDate`, allows you to disabled one or multiple dates with datepicker API
30+
* added prop `disabledDates` - it is a Set which holds all disabled dates
31+
* added possibility to pass `{silent: true}` to `update` and `setCurrentView` methods, [#583](https://github.com/t1m0n/air-datepicker/issues/568)
32+
* changed `update` method - now if you pass `selectedDates` here then calendar will keep selected only those dates
33+
* fixed localization generation
34+
* fixed selecting time on same date when `range: true`, [#568](https://github.com/t1m0n/air-datepicker/issues/568)
35+
* fixed date conversion to local date when using strings, e.g `selectDate('2024-03-05')` [#589](https://github.com/t1m0n/air-datepicker/issues/589)
36+
37+
### v3.4.0
38+
* added new options `onFocus` and `onBeforeSelect` grant you more control over range selection behaviour and more [#526](https://github.com/t1m0n/air-datepicker/issues/526)
39+
* added new method `getViewDates()` allows you to get all dates that should be currently displayed in calendar [#536](https://github.com/t1m0n/air-datepicker/issues/536)
40+
* `toggleSelected` now can be a function [#534](https://github.com/t1m0n/air-datepicker/issues/534)
41+
* fixed `clear` method [#546](https://github.com/t1m0n/air-datepicker/issues/546)
42+
* added Bulgarian locale, thanks to [tonytomov](https://github.com/tonytomov), in [#531](https://github.com/t1m0n/air-datepicker/pull/531)
43+
* added Catalan locale, thanks to [joatb](https://github.com/joatb), in [#542](https://github.com/t1m0n/air-datepicker/pull/542)
44+
* added Croatian Locale, thanks to [diomed](https://github.com/diomed), in [#551](https://github.com/t1m0n/air-datepicker/pull/551)
45+
2946
### v3.3.5
3047
* added handling of optional chaining operator in dist package [#518](https://github.com/t1m0n/air-datepicker/issues/518)
3148
* added Indonesian locale, thanks to [BariqDharmawan](https://github.com/BariqDharmawan), in [#517](https://github.com/t1m0n/air-datepicker/pull/517)
3249

33-
### v3.3.4
34-
* recreate global container if it was removed from DOM [#516](https://github.com/t1m0n/air-datepicker/issues/516)
35-
* added Greek locale, thanks to [sonole](https://github.com/sonole), in [#515](https://github.com/t1m0n/air-datepicker/pull/515)
36-
37-
### v3.3.3
38-
* fixed time format in timepicker body [#512](https://github.com/t1m0n/air-datepicker/issues/512)
39-
40-
### v3.3.2
41-
* fixed day period value, when selecting date while datepicker is not active, [#510](https://github.com/t1m0n/air-datepicker/issues/510)
42-
* fixed German locale, [#511](https://github.com/t1m0n/air-datepicker/issues/511)
43-
44-
### v3.3.1
45-
* added Japanese locale, thanks to [kyong0612](https://github.com/kyong0612), in [#505](https://github.com/t1m0n/air-datepicker/pull/505)
46-
* added Korean locale, thanks to [YankeeTube](https://github.com/YankeeTube), in [#506](https://github.com/t1m0n/air-datepicker/pull/506)
47-
48-
### v3.3.0
49-
* new feature that allow you to add custom attributes via `onRenderCell` [#502](https://github.com/t1m0n/air-datepicker/issues/502), [read docs](https://air-datepicker.com/docs?scrollTo=onRenderCell)
50-
* fixed selecting cell when using custom html with `onRenderCell` option [#502](https://github.com/t1m0n/air-datepicker/issues/502)
51-
52-
### v3.2.1
53-
* added Arabic locale, thanks to [abdo-host](https://github.com/abdo-host) [#497](https://github.com/t1m0n/air-datepicker/pull/497)
54-
* added Italian locale, thanks to [msaltieri](https://github.com/msaltieri) [#498](https://github.com/t1m0n/air-datepicker/pull/498)
55-
56-
### v3.2.0
57-
* added `onClickDayName` option, [#459](https://github.com/t1m0n/air-datepicker/issues/459)
58-
* added `silent` param to `clear` method, [#477](https://github.com/t1m0n/air-datepicker/issues/477)
59-
* added Swedish locale, thanks to [naton](https://github.com/naton) [#207](https://github.com/t1m0n/air-datepicker/pull/207)
60-
* fixed error when trying to call `update` method with `view` parameter on hidden calendar, [#476](https://github.com/t1m0n/air-datepicker/issues/476)
61-
* fixed styles issue with time sliders, [#489](https://github.com/t1m0n/air-datepicker/issues/489)
62-
* fixed English docs description, [#490](https://github.com/t1m0n/air-datepicker/issues/490)
63-
* fixed typings for `formatDate` method, [#491](https://github.com/t1m0n/air-datepicker/issues/491)
64-
65-
6650
## Version 3.0.0 highlights
6751
It is been a while since the last release, a lot of work has been done, and I'm glad to finally present a new version of Air Datepicker.
6852

dist/air-datepicker.d.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export declare type AirDatepickerOptions<E extends HTMLElement = HTMLInputElemen
9898
maxMinutes?: number,
9999
hoursStep?: number,
100100
minutesStep?: number,
101+
fixedHeight?: boolean,
101102

102103
onSelect?: ({date, formattedDate, datepicker}: {date: Date | Date[], formattedDate: string | string[], datepicker: AirDatepicker<E>}) => void,
103104
onChangeViewDate?: ({month, year, decade}: {month: number, year: number, decade: AirDatepickerDecade}) => void,
@@ -128,15 +129,17 @@ declare class AirDatepicker<E extends HTMLElement = HTMLInputElement> {
128129
prev: () => void
129130
selectDate: (date: AirDatepickerDate | AirDatepickerDate[], opts?: {updateTime?: boolean, silent?: boolean}) => void
130131
unselectDate: (date: AirDatepickerDate) => void
131-
clear: () => void
132+
clear: (opts?: {silent?: boolean}) => void
132133
formatDate: (date: AirDatepickerDate, format: string) => string
133134
destroy: () => void
134-
update: (newOpts?: AirDatepickerOptions) => void
135-
setCurrentView: (newView: AirDatepickerViews) => void
135+
update: (newOpts?: AirDatepickerOptions, params?: {silent?: boolean}) => void
136+
setCurrentView: (newView: AirDatepickerViews, params?: {silent?: boolean}) => void
136137
setViewDate: (newViewDate: AirDatepickerDate) => void
137138
setFocusDate: (date: AirDatepickerDate | false, opts?: {viewDateTransition?: boolean}) => void
138139
up: (date?: AirDatepickerDate) => void
139140
down: (date?: AirDatepickerDate) => void
141+
disableDate: (date: AirDatepickerDate | AirDatepickerDate[]) => void
142+
enableDate: (date: AirDatepickerDate | AirDatepickerDate[]) => void
140143

141144
$el: E
142145
$datepicker: HTMLDivElement
@@ -145,6 +148,7 @@ declare class AirDatepicker<E extends HTMLElement = HTMLInputElement> {
145148
selectedDates: Date[]
146149
focusDate: Date | false
147150
visible: boolean
151+
disabledDates: Set<string>
148152
}
149153

150154

dist/air-datepicker.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/locale/de.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var _default = {
1111
months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
1212
monthsShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
1313
today: 'Heute',
14-
clear: 'Aufräumen',
14+
clear: 'Löschen',
1515
dateFormat: 'dd.MM.yyyy',
1616
timeFormat: 'HH:mm',
1717
firstDay: 1

dist/locale/eu.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module 'air-datepicker/locale/eu' {
2+
import {AirDatepickerLocale} from 'air-datepicker';
3+
const eu: AirDatepickerLocale;
4+
5+
export default eu;
6+
}

dist/locale/eu.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.default = void 0;
7+
var _default = {
8+
days: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata'],
9+
daysShort: ['Iga', 'Ast', 'Asr', 'Asz', 'Ost', 'Osr', 'Lar'],
10+
daysMin: ['Ig', 'As', 'Ar', 'Az', 'Os', 'Or', 'La'],
11+
months: ['Urtarrila', 'Otsaila', 'Martxoa', 'Apirila', 'Maiatza', 'Ekaina', 'Uztaila', 'Abuztua', 'Iraila', 'Urria', 'Azaroa', 'Abendua'],
12+
monthsShort: ['Urt', 'Ots', 'Mar', 'Api', 'Mai', 'Eka', 'Uzt', 'Abu', 'Ira', 'Urr', 'Aza', 'Abe'],
13+
today: 'Gaur',
14+
clear: 'Garbitu',
15+
dateFormat: 'dd/MM/yyyy',
16+
timeFormat: 'hh:mm aa',
17+
firstDay: 1
18+
};
19+
exports.default = _default;

dist/locale/nb.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module 'air-datepicker/locale/nb' {
2+
import {AirDatepickerLocale} from 'air-datepicker';
3+
const nb: AirDatepickerLocale;
4+
5+
export default nb;
6+
}

dist/locale/nb.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.default = void 0;
7+
var _default = {
8+
days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"],
9+
daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"],
10+
daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø"],
11+
months: ["Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"],
12+
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"],
13+
today: "Idag",
14+
clear: "Fjern",
15+
dateFormat: "dd.mm.yyyy",
16+
timeFormat: "HH:mm",
17+
firstDay: 1
18+
};
19+
exports.default = _default;

dist/locale/pt-BR.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare module 'air-datepicker/locale/pt-BR' {
22
import {AirDatepickerLocale} from 'air-datepicker';
3-
const pt-BR: AirDatepickerLocale;
3+
const ptBr: AirDatepickerLocale;
44

5-
export default pt-BR;
5+
export default ptBr;
66
}

dist/locale/sl.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module 'air-datepicker/locale/sl' {
2+
import {AirDatepickerLocale} from 'air-datepicker';
3+
const sl: AirDatepickerLocale;
4+
5+
export default sl;
6+
}

dist/locale/sl.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.default = void 0;
7+
var _default = {
8+
days: ['Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Četrtek', 'Petek', 'Sobota'],
9+
daysShort: ['Ned', 'Pon', 'Tor', 'Sre', 'Čet', 'Pet', 'Sob'],
10+
daysMin: ['Ned', 'Pon', 'Tor', 'Sre', 'Čet', 'Pet', 'Sob'],
11+
months: ['Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December'],
12+
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'],
13+
today: 'Danes',
14+
clear: 'Počisti',
15+
dateFormat: 'dd.mm.yyyy',
16+
timeFormat: 'hh:ii aa',
17+
firstDay: 1
18+
};
19+
exports.default = _default;

dist/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "air-datepicker",
3-
"version": "3.4.0",
3+
"version": "3.5.0",
44
"scripts": {
55
"dev": "set NODE_ENV=development&& webpack",
66
"dev:serve": "npm run browser&& set NODE_ENV=development&& webpack serve",
@@ -20,6 +20,7 @@
2020
"@babel/preset-env": "^7.20.2",
2121
"@popperjs/core": "^2.10.2",
2222
"@testing-library/jest-dom": "^5.16.1",
23+
"@types/lodash": "^4.14.191",
2324
"animejs": "^3.2.1",
2425
"autoprefixer": "^10.4.13",
2526
"babel-eslint": "^10.1.0",
@@ -32,7 +33,9 @@
3233
"express": "^4.17.1",
3334
"glob": "^7.1.7",
3435
"html-webpack-plugin": "^5.3.1",
35-
"jest": "^26.6.3",
36+
"jest": "^29.7.0",
37+
"jest-environment-jsdom": "^29.7.0",
38+
"lodash": "^4.17.21",
3639
"mini-css-extract-plugin": "^1.6.0",
3740
"node-gzip": "^1.1.2",
3841
"open-cli": "^6.0.1",

0 commit comments

Comments
 (0)