@vaadin/date-picker 25.3.0-alpha13 → 25.3.0-alpha14
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/package.json +13 -13
- package/src/vaadin-date-picker-helper.d.ts +127 -13
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
39
|
-
"@vaadin/button": "25.3.0-
|
|
40
|
-
"@vaadin/component-base": "25.3.0-
|
|
41
|
-
"@vaadin/field-base": "25.3.0-
|
|
42
|
-
"@vaadin/input-container": "25.3.0-
|
|
43
|
-
"@vaadin/overlay": "25.3.0-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.3.0-alpha14",
|
|
39
|
+
"@vaadin/button": "25.3.0-alpha14",
|
|
40
|
+
"@vaadin/component-base": "25.3.0-alpha14",
|
|
41
|
+
"@vaadin/field-base": "25.3.0-alpha14",
|
|
42
|
+
"@vaadin/input-container": "25.3.0-alpha14",
|
|
43
|
+
"@vaadin/overlay": "25.3.0-alpha14",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha14",
|
|
45
45
|
"lit": "^3.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@vaadin/aura": "25.3.0-
|
|
49
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
48
|
+
"@vaadin/aura": "25.3.0-alpha14",
|
|
49
|
+
"@vaadin/chai-plugins": "25.3.0-alpha14",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha14",
|
|
51
51
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha14",
|
|
53
53
|
"sinon": "^22.0.0"
|
|
54
54
|
},
|
|
55
55
|
"customElements": "custom-elements.json",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"web-types.json",
|
|
58
58
|
"web-types.lit.json"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "10a01ae7a1e278af50eda7255dbb68dafc0e4caf"
|
|
61
61
|
}
|
|
@@ -6,19 +6,85 @@
|
|
|
6
6
|
import type { DateMetadataController } from './vaadin-date-metadata-controller.js';
|
|
7
7
|
import type { DatePickerDate } from './vaadin-date-picker-mixin.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Create a date at midnight in local time. Unlike `new Date(year, month, day)`,
|
|
11
|
+
* this supports years below 100, which the constructor maps into the 20th
|
|
12
|
+
* century. The month is assigned before the day so that the initial day of month
|
|
13
|
+
* (1) always exists in the target month.
|
|
14
|
+
*
|
|
15
|
+
* @param month Zero-based month, may be out of range to shift the year
|
|
16
|
+
* @param day May be `0` to select the last day of the previous month
|
|
17
|
+
*/
|
|
18
|
+
declare function createDate(year: number, month: number, day: number): Date;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get the first day of the month the given date is in.
|
|
22
|
+
*/
|
|
23
|
+
declare function firstOfMonth(date: Date): Date;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get the last day of the month the given date is in.
|
|
27
|
+
*/
|
|
28
|
+
declare function lastOfMonth(date: Date): Date;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the index of a month, counted from January of year 0. Reduces a month to a single
|
|
32
|
+
* integer, so a lookup builds no key and two months are adjacent when their indexes are.
|
|
33
|
+
*
|
|
34
|
+
* @param month Zero-based month
|
|
35
|
+
*/
|
|
36
|
+
declare function monthIndexOf(year: number, month: number): number;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get the index of the month the given date is in.
|
|
40
|
+
*/
|
|
41
|
+
declare function monthIndex(date: Date): number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get the first day of the month with the given index, inverting `monthIndexOf`. Counting from
|
|
45
|
+
* January of year 0 also inverts negative indexes, since `createDate` normalizes a month outside
|
|
46
|
+
* 0-11 into the year.
|
|
47
|
+
*/
|
|
48
|
+
declare function monthDate(index: number): Date;
|
|
49
|
+
|
|
9
50
|
/**
|
|
10
51
|
* Get ISO 8601 week number for the given date.
|
|
11
52
|
*
|
|
12
53
|
* @returns Week number
|
|
13
54
|
*/
|
|
14
|
-
declare function getISOWeekNumber(
|
|
55
|
+
declare function getISOWeekNumber(date: Date): number;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new object with the same date, but sets the hours, minutes, seconds and milliseconds to 0.
|
|
59
|
+
*
|
|
60
|
+
* @param date in system timezone
|
|
61
|
+
* @returns The same date with time elements set to 0, in system timezone.
|
|
62
|
+
*/
|
|
63
|
+
declare function normalizeDate(date: Date): Date;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Creates a new object with the same date, but sets the hours, minutes, seconds and milliseconds to 0.
|
|
67
|
+
*
|
|
68
|
+
* Uses UTC date components to allow handling date instances independently of
|
|
69
|
+
* the system time-zone.
|
|
70
|
+
*
|
|
71
|
+
* @param date in UTC timezone
|
|
72
|
+
* @returns The same date with time elements set to 0, in UTC timezone.
|
|
73
|
+
*/
|
|
74
|
+
declare function normalizeUTCDate(date: Date): Date;
|
|
15
75
|
|
|
16
76
|
/**
|
|
17
77
|
* Check if two dates are equal.
|
|
18
78
|
*
|
|
19
79
|
* @returns True if the given date objects refer to the same date
|
|
20
80
|
*/
|
|
21
|
-
declare function dateEquals(date1: Date | null, date2: Date | null): boolean;
|
|
81
|
+
declare function dateEquals(date1: Date | null, date2: Date | null, normalizer?: (date: Date) => Date): boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Extracts the basic component parts of a date (day, month and year)
|
|
85
|
+
* to the expected format.
|
|
86
|
+
*/
|
|
87
|
+
declare function extractDateParts(date: Date): { day: number; month: number; year: number };
|
|
22
88
|
|
|
23
89
|
/**
|
|
24
90
|
* Check if the given date is in the range of allowed dates.
|
|
@@ -55,37 +121,85 @@ declare function dateSelectable(
|
|
|
55
121
|
declare function getClosestDate(date: Date, dates: Date[]): Date;
|
|
56
122
|
|
|
57
123
|
/**
|
|
58
|
-
*
|
|
59
|
-
* to the expected format.
|
|
124
|
+
* Get difference in months between today and given months value.
|
|
60
125
|
*/
|
|
61
|
-
declare function
|
|
126
|
+
declare function dateAfterXMonths(months: number): Date;
|
|
62
127
|
|
|
63
128
|
/**
|
|
64
|
-
*
|
|
129
|
+
* Calculate the year of the date based on the provided reference date.
|
|
130
|
+
* Gets a two-digit year and returns a full year.
|
|
131
|
+
*
|
|
132
|
+
* @param year Should be in the range of [0, 99]
|
|
133
|
+
* @returns Adjusted year value
|
|
65
134
|
*/
|
|
66
|
-
declare function
|
|
135
|
+
declare function getAdjustedYear(referenceDate: Date, year: number, month?: number, day?: number): number;
|
|
67
136
|
|
|
68
137
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
138
|
+
* Parse date string of one of the following date formats:
|
|
139
|
+
* - ISO 8601 `"YYYY-MM-DD"`
|
|
140
|
+
* - Extended ISO 8601 with a signed year, e.g. `"+012026-MM-DD"` or `"-0001-MM-DD"`
|
|
141
|
+
*
|
|
142
|
+
* A date that does not exist, such as `"2026-02-30"`, is not parsed. Building it would carry the
|
|
143
|
+
* surplus into the next month or year and answer with a date that was never asked for.
|
|
144
|
+
*
|
|
145
|
+
* @param str Date string to parse
|
|
146
|
+
* @returns Parsed date in system timezone, or `undefined` when the string is not a date
|
|
71
147
|
*/
|
|
72
|
-
declare function
|
|
148
|
+
declare function parseDate(str: string): Date | undefined;
|
|
73
149
|
|
|
74
150
|
/**
|
|
75
151
|
* Parse date string of one of the following date formats:
|
|
76
152
|
* - ISO 8601 `"YYYY-MM-DD"`
|
|
77
|
-
* -
|
|
153
|
+
* - Extended ISO 8601 with a signed year, e.g. `"+012026-MM-DD"` or `"-0001-MM-DD"`
|
|
154
|
+
*
|
|
155
|
+
* Uses UTC date components to allow handling date instances independently of
|
|
156
|
+
* the system time-zone.
|
|
157
|
+
*
|
|
158
|
+
* A date that does not exist, such as `"2026-02-30"`, is not parsed, as in `parseDate`.
|
|
159
|
+
*
|
|
160
|
+
* @param str Date string to parse
|
|
161
|
+
* @returns Parsed date in UTC timezone, or `undefined` when the string is not a date
|
|
162
|
+
*/
|
|
163
|
+
declare function parseUTCDate(str: string): Date | undefined;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Format a date instance in ISO 8601 (`"YYYY-MM-DD"`) or 6-digit extended ISO
|
|
167
|
+
* 8601 (`"+YYYYYY-MM-DD"`, `"-YYYYYY-MM-DD"`) format.
|
|
168
|
+
*
|
|
169
|
+
* @param date in system timezone
|
|
78
170
|
*/
|
|
79
|
-
declare function
|
|
171
|
+
declare function formatISODate(date: Date): string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Format a date instance in ISO 8601 (`"YYYY-MM-DD"`) or 6-digit extended ISO
|
|
175
|
+
* 8601 (`"+YYYYYY-MM-DD"`, `"-YYYYYY-MM-DD"`) format.
|
|
176
|
+
*
|
|
177
|
+
* Uses UTC date components to allow handling date instances independently of
|
|
178
|
+
* the system time-zone.
|
|
179
|
+
*
|
|
180
|
+
* @param date in UTC timezone
|
|
181
|
+
*/
|
|
182
|
+
declare function formatUTCISODate(date: Date): string;
|
|
80
183
|
|
|
81
184
|
export {
|
|
185
|
+
createDate,
|
|
186
|
+
firstOfMonth,
|
|
187
|
+
lastOfMonth,
|
|
188
|
+
monthIndexOf,
|
|
189
|
+
monthIndex,
|
|
190
|
+
monthDate,
|
|
82
191
|
getISOWeekNumber,
|
|
192
|
+
normalizeDate,
|
|
193
|
+
normalizeUTCDate,
|
|
83
194
|
dateEquals,
|
|
195
|
+
extractDateParts,
|
|
84
196
|
dateAllowed,
|
|
85
197
|
dateSelectable,
|
|
86
198
|
getClosestDate,
|
|
87
|
-
extractDateParts,
|
|
88
199
|
dateAfterXMonths,
|
|
89
200
|
getAdjustedYear,
|
|
90
201
|
parseDate,
|
|
202
|
+
parseUTCDate,
|
|
203
|
+
formatISODate,
|
|
204
|
+
formatUTCISODate,
|
|
91
205
|
};
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED