date-vir 7.3.2 → 7.4.1
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/dist/duration-shape.d.ts +11 -0
- package/dist/duration-shape.js +12 -0
- package/dist/formatting/html-input.js +1 -1
- package/dist/full-date/string-parsing.js +13 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DurationUnit } from '@date-vir/duration';
|
|
2
|
+
/**
|
|
3
|
+
* A shape definition for `AnyDuration`.
|
|
4
|
+
*
|
|
5
|
+
* @category Duration
|
|
6
|
+
*/
|
|
7
|
+
export declare const anyDurationShape: import("object-shape-tester").ShapeIndexedKeys<[{
|
|
8
|
+
keys: import("object-shape-tester").ShapeEnum<readonly [typeof DurationUnit]>;
|
|
9
|
+
values: number;
|
|
10
|
+
required: false;
|
|
11
|
+
}]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DurationUnit } from '@date-vir/duration';
|
|
2
|
+
import { enumShape, indexedKeys } from 'object-shape-tester';
|
|
3
|
+
/**
|
|
4
|
+
* A shape definition for `AnyDuration`.
|
|
5
|
+
*
|
|
6
|
+
* @category Duration
|
|
7
|
+
*/
|
|
8
|
+
export const anyDurationShape = indexedKeys({
|
|
9
|
+
keys: enumShape(DurationUnit),
|
|
10
|
+
values: -1,
|
|
11
|
+
required: false,
|
|
12
|
+
});
|
|
@@ -42,6 +42,6 @@ export function toHtmlInputString(fullDate, inputType, includeSeconds) {
|
|
|
42
42
|
return `${datePart}T${timePart}`;
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
throw new Error(`Unexpected inputTyped: '${
|
|
45
|
+
throw new Error(`Unexpected inputTyped: '${inputType}'. Expected usage of FullDatePart, one of ${getEnumValues(FullDatePart).join(', ')}.`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -22,6 +22,18 @@ const knownStringFormats = [
|
|
|
22
22
|
// padded hour
|
|
23
23
|
// Sat, 01 Jun 2025 6:23:21 +0000 (UTC)
|
|
24
24
|
'ccc, d LLL y HH:mm:ss ZZZ (z)',
|
|
25
|
+
// no padding
|
|
26
|
+
// Sat, 1 Jun 2025 6:23:21 +0000
|
|
27
|
+
'ccc, d LLL y H:mm:ss ZZZ',
|
|
28
|
+
// all padding
|
|
29
|
+
// Sat, 01 Jun 2025 06:23:21 +0000
|
|
30
|
+
'ccc, dd LLL y HH:mm:ss ZZZ',
|
|
31
|
+
// padded day
|
|
32
|
+
// Sat, 01 Jun 2025 6:23:21 +0000
|
|
33
|
+
'ccc, dd LLL y H:mm:ss ZZZ',
|
|
34
|
+
// padded hour
|
|
35
|
+
// Sat, 01 Jun 2025 6:23:21 +0000
|
|
36
|
+
'ccc, d LLL y HH:mm:ss ZZZ',
|
|
25
37
|
];
|
|
26
38
|
/**
|
|
27
39
|
* Tries extra known formats for parsing date strings, even those that browsers do not natively
|
|
@@ -36,7 +48,7 @@ export function parseDateString(dateString, timezone) {
|
|
|
36
48
|
}
|
|
37
49
|
let finalizedDateTime;
|
|
38
50
|
knownStringFormats.some((format) => {
|
|
39
|
-
const dateTimeAttempt = DateTime.fromFormat(dateString, format, { zone: timezone });
|
|
51
|
+
const dateTimeAttempt = DateTime.fromFormat(dateString.trim(), format, { zone: timezone });
|
|
40
52
|
if (!dateTimeAttempt.isValid) {
|
|
41
53
|
return false;
|
|
42
54
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './date-operations/calculate-relative-date.js';
|
|
|
2
2
|
export * from './date-operations/combine-dates.js';
|
|
3
3
|
export * from './date-operations/date-position.js';
|
|
4
4
|
export * from './date-operations/diff-dates.js';
|
|
5
|
+
export * from './duration-shape.js';
|
|
5
6
|
export * from './extra-utils/end.js';
|
|
6
7
|
export * from './extra-utils/has-date-props.js';
|
|
7
8
|
export * from './extra-utils/js-date-conversion.js';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './date-operations/calculate-relative-date.js';
|
|
|
2
2
|
export * from './date-operations/combine-dates.js';
|
|
3
3
|
export * from './date-operations/date-position.js';
|
|
4
4
|
export * from './date-operations/diff-dates.js';
|
|
5
|
+
export * from './duration-shape.js';
|
|
5
6
|
export * from './extra-utils/end.js';
|
|
6
7
|
export * from './extra-utils/has-date-props.js';
|
|
7
8
|
export * from './extra-utils/js-date-conversion.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "date-vir",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "Easy and explicit dates and times.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"date",
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
"test:docs": "virmator docs check"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@augment-vir/assert": "^31.
|
|
38
|
-
"@augment-vir/common": "^31.
|
|
39
|
-
"@date-vir/duration": "^7.
|
|
40
|
-
"@types/luxon": "^3.
|
|
41
|
-
"luxon": "^3.
|
|
42
|
-
"object-shape-tester": "^5.
|
|
37
|
+
"@augment-vir/assert": "^31.33.0",
|
|
38
|
+
"@augment-vir/common": "^31.33.0",
|
|
39
|
+
"@date-vir/duration": "^7.4.1",
|
|
40
|
+
"@types/luxon": "^3.7.1",
|
|
41
|
+
"luxon": "^3.7.1",
|
|
42
|
+
"object-shape-tester": "^5.3.0",
|
|
43
43
|
"type-fest": "^4.41.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@augment-vir/test": "^31.
|
|
46
|
+
"@augment-vir/test": "^31.33.0",
|
|
47
47
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
48
48
|
"@web/test-runner": "^0.20.2",
|
|
49
49
|
"@web/test-runner-commands": "^0.9.0",
|
|
50
50
|
"@web/test-runner-playwright": "^0.11.1",
|
|
51
51
|
"@web/test-runner-visual-regression": "^0.10.0",
|
|
52
|
-
"element-vir": "^26.
|
|
52
|
+
"element-vir": "^26.9.0",
|
|
53
53
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
54
54
|
"markdown-code-example-inserter": "^3.0.3",
|
|
55
|
-
"typedoc": "^0.28.
|
|
56
|
-
"typescript": "^5.
|
|
55
|
+
"typedoc": "^0.28.11",
|
|
56
|
+
"typescript": "^5.9.2"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=22"
|