@checkdigit/time 5.0.0-PR.21-177c → 5.0.0-PR.21-c1b2

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 CHANGED
@@ -12,7 +12,7 @@ The [`date-fns`](https://date-fns.org) library is included. The only locale curr
12
12
  available functionality as of v4.1.0 except that the code in `fp` folder are excluded, which contain functional programming related stuff that is not used at the moment.
13
13
 
14
14
  Additionally, the [`date-fns-tz`](https://github.com/marnusw/date-fns-tz) library is included. Contains all
15
- available functionality as of v3.0.0 except that the code in `fp` folder are excluded, which contain functional programming related stuff that is not used at the moment.
15
+ available functionality as of v3.2.0 except that the code in `fp` folder are excluded, which contain functional programming related stuff that is not used at the moment.
16
16
 
17
17
  ## `formatUtc`
18
18
 
@@ -44,7 +44,6 @@ The documentation for `date-fns-tz` is here: https://github.com/marnusw/date-fns
44
44
 
45
45
  When updating the latest code from the original repositories, except making all the necessary changes to make them fully typescript compatible, please remember to carry over the patches to overcome the following issues:
46
46
 
47
- - spring-forward support
48
- - nanosecond support
47
+ - hours is incorrect when it's close to daylight saving timezone threshold
49
48
 
50
49
  Please search for `[PATCH:]` in the existing codebase.
@@ -1,97 +1,3 @@
1
1
  // src/date-fns/locale/index.ts
2
- export * from "./af/index.mjs";
3
- export * from "./ar/index.mjs";
4
- export * from "./ar-DZ/index.mjs";
5
- export * from "./ar-EG/index.mjs";
6
- export * from "./ar-MA/index.mjs";
7
- export * from "./ar-SA/index.mjs";
8
- export * from "./ar-TN/index.mjs";
9
- export * from "./az/index.mjs";
10
- export * from "./be/index.mjs";
11
- export * from "./be-tarask/index.mjs";
12
- export * from "./bg/index.mjs";
13
- export * from "./bn/index.mjs";
14
- export * from "./bs/index.mjs";
15
- export * from "./ca/index.mjs";
16
- export * from "./ckb/index.mjs";
17
- export * from "./cs/index.mjs";
18
- export * from "./cy/index.mjs";
19
- export * from "./da/index.mjs";
20
- export * from "./de/index.mjs";
21
- export * from "./de-AT/index.mjs";
22
- export * from "./el/index.mjs";
23
- export * from "./en-AU/index.mjs";
24
- export * from "./en-CA/index.mjs";
25
- export * from "./en-GB/index.mjs";
26
- export * from "./en-IE/index.mjs";
27
- export * from "./en-IN/index.mjs";
28
- export * from "./en-NZ/index.mjs";
29
2
  export * from "./en-US/index.mjs";
30
- export * from "./en-ZA/index.mjs";
31
- export * from "./eo/index.mjs";
32
- export * from "./es/index.mjs";
33
- export * from "./et/index.mjs";
34
- export * from "./eu/index.mjs";
35
- export * from "./fa-IR/index.mjs";
36
- export * from "./fi/index.mjs";
37
- export * from "./fr/index.mjs";
38
- export * from "./fr-CA/index.mjs";
39
- export * from "./fr-CH/index.mjs";
40
- export * from "./fy/index.mjs";
41
- export * from "./gd/index.mjs";
42
- export * from "./gl/index.mjs";
43
- export * from "./gu/index.mjs";
44
- export * from "./he/index.mjs";
45
- export * from "./hi/index.mjs";
46
- export * from "./hr/index.mjs";
47
- export * from "./ht/index.mjs";
48
- export * from "./hu/index.mjs";
49
- export * from "./hy/index.mjs";
50
- export * from "./id/index.mjs";
51
- export * from "./is/index.mjs";
52
- export * from "./it/index.mjs";
53
- export * from "./it-CH/index.mjs";
54
- export * from "./ja/index.mjs";
55
- export * from "./ja-Hira/index.mjs";
56
- export * from "./ka/index.mjs";
57
- export * from "./kk/index.mjs";
58
- export * from "./km/index.mjs";
59
- export * from "./kn/index.mjs";
60
- export * from "./ko/index.mjs";
61
- export * from "./lb/index.mjs";
62
- export * from "./lt/index.mjs";
63
- export * from "./lv/index.mjs";
64
- export * from "./mk/index.mjs";
65
- export * from "./mn/index.mjs";
66
- export * from "./ms/index.mjs";
67
- export * from "./mt/index.mjs";
68
- export * from "./nb/index.mjs";
69
- export * from "./nl/index.mjs";
70
- export * from "./nl-BE/index.mjs";
71
- export * from "./nn/index.mjs";
72
- export * from "./oc/index.mjs";
73
- export * from "./pl/index.mjs";
74
- export * from "./pt/index.mjs";
75
- export * from "./pt-BR/index.mjs";
76
- export * from "./ro/index.mjs";
77
- export * from "./ru/index.mjs";
78
- export * from "./se/index.mjs";
79
- export * from "./sk/index.mjs";
80
- export * from "./sl/index.mjs";
81
- export * from "./sq/index.mjs";
82
- export * from "./sr/index.mjs";
83
- export * from "./sr-Latn/index.mjs";
84
- export * from "./sv/index.mjs";
85
- export * from "./ta/index.mjs";
86
- export * from "./te/index.mjs";
87
- export * from "./th/index.mjs";
88
- export * from "./tr/index.mjs";
89
- export * from "./ug/index.mjs";
90
- export * from "./uk/index.mjs";
91
- export * from "./uz/index.mjs";
92
- export * from "./uz-Cyrl/index.mjs";
93
- export * from "./vi/index.mjs";
94
- export * from "./zh-CN/index.mjs";
95
- export * from "./zh-HK/index.mjs";
96
- export * from "./zh-TW/index.mjs";
97
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2RhdGUtZm5zL2xvY2FsZS9pbmRleC50cyJdLAogICJtYXBwaW5ncyI6ICI7QUFNQSxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYzsiLAogICJuYW1lcyI6IFtdCn0K
3
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2RhdGUtZm5zL2xvY2FsZS9pbmRleC50cyJdLAogICJtYXBwaW5ncyI6ICI7QUFNQSxjQUFjOyIsCiAgIm5hbWVzIjogW10KfQo=
@@ -1,3 +1,3 @@
1
1
  // src/date-fns/types.ts
2
- import "./constants/index.mjs";
3
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2RhdGUtZm5zL3R5cGVzLnRzIl0sCiAgIm1hcHBpbmdzIjogIjtBQUlBLE9BQXlDOyIsCiAgIm5hbWVzIjogW10KfQo=
2
+ import "./locale/types.mjs";
3
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2RhdGUtZm5zL3R5cGVzLnRzIl0sCiAgIm1hcHBpbmdzIjogIjtBQUtBLE9BQXVCOyIsCiAgIm5hbWVzIjogW10KfQo=
@@ -1,96 +1,2 @@
1
- export * from './af/index.ts';
2
- export * from './ar/index.ts';
3
- export * from './ar-DZ/index.ts';
4
- export * from './ar-EG/index.ts';
5
- export * from './ar-MA/index.ts';
6
- export * from './ar-SA/index.ts';
7
- export * from './ar-TN/index.ts';
8
- export * from './az/index.ts';
9
- export * from './be/index.ts';
10
- export * from './be-tarask/index.ts';
11
- export * from './bg/index.ts';
12
- export * from './bn/index.ts';
13
- export * from './bs/index.ts';
14
- export * from './ca/index.ts';
15
- export * from './ckb/index.ts';
16
- export * from './cs/index.ts';
17
- export * from './cy/index.ts';
18
- export * from './da/index.ts';
19
- export * from './de/index.ts';
20
- export * from './de-AT/index.ts';
21
- export * from './el/index.ts';
22
- export * from './en-AU/index.ts';
23
- export * from './en-CA/index.ts';
24
- export * from './en-GB/index.ts';
25
- export * from './en-IE/index.ts';
26
- export * from './en-IN/index.ts';
27
- export * from './en-NZ/index.ts';
28
1
  export * from './en-US/index.ts';
29
- export * from './en-ZA/index.ts';
30
- export * from './eo/index.ts';
31
- export * from './es/index.ts';
32
- export * from './et/index.ts';
33
- export * from './eu/index.ts';
34
- export * from './fa-IR/index.ts';
35
- export * from './fi/index.ts';
36
- export * from './fr/index.ts';
37
- export * from './fr-CA/index.ts';
38
- export * from './fr-CH/index.ts';
39
- export * from './fy/index.ts';
40
- export * from './gd/index.ts';
41
- export * from './gl/index.ts';
42
- export * from './gu/index.ts';
43
- export * from './he/index.ts';
44
- export * from './hi/index.ts';
45
- export * from './hr/index.ts';
46
- export * from './ht/index.ts';
47
- export * from './hu/index.ts';
48
- export * from './hy/index.ts';
49
- export * from './id/index.ts';
50
- export * from './is/index.ts';
51
- export * from './it/index.ts';
52
- export * from './it-CH/index.ts';
53
- export * from './ja/index.ts';
54
- export * from './ja-Hira/index.ts';
55
- export * from './ka/index.ts';
56
- export * from './kk/index.ts';
57
- export * from './km/index.ts';
58
- export * from './kn/index.ts';
59
- export * from './ko/index.ts';
60
- export * from './lb/index.ts';
61
- export * from './lt/index.ts';
62
- export * from './lv/index.ts';
63
- export * from './mk/index.ts';
64
- export * from './mn/index.ts';
65
- export * from './ms/index.ts';
66
- export * from './mt/index.ts';
67
- export * from './nb/index.ts';
68
- export * from './nl/index.ts';
69
- export * from './nl-BE/index.ts';
70
- export * from './nn/index.ts';
71
- export * from './oc/index.ts';
72
- export * from './pl/index.ts';
73
- export * from './pt/index.ts';
74
- export * from './pt-BR/index.ts';
75
- export * from './ro/index.ts';
76
- export * from './ru/index.ts';
77
- export * from './se/index.ts';
78
- export * from './sk/index.ts';
79
- export * from './sl/index.ts';
80
- export * from './sq/index.ts';
81
- export * from './sr/index.ts';
82
- export * from './sr-Latn/index.ts';
83
- export * from './sv/index.ts';
84
- export * from './ta/index.ts';
85
- export * from './te/index.ts';
86
- export * from './th/index.ts';
87
- export * from './tr/index.ts';
88
- export * from './ug/index.ts';
89
- export * from './uk/index.ts';
90
- export * from './uz/index.ts';
91
- export * from './uz-Cyrl/index.ts';
92
- export * from './vi/index.ts';
93
- export * from './zh-CN/index.ts';
94
- export * from './zh-HK/index.ts';
95
- export * from './zh-TW/index.ts';
96
2
  export type * from './types.ts';
@@ -1,5 +1,5 @@
1
- import { type constructFromSymbol } from './constants/index.ts';
2
- import type { Locale } from './locale/types.ts';
1
+ import type { constructFromSymbol } from './constants/index.ts';
2
+ import { Locale } from './locale/types.ts';
3
3
  export type * from './locale/types.ts';
4
4
  /**
5
5
  * The argument type.
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@checkdigit/time","version":"5.0.0-PR.21-177c","description":"Standard time handling","homepage":"https://github.com/checkdigit/time#readme","bugs":{"url":"https://github.com/checkdigit/time/issues"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/time.git"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"rimraf coverage && mkdir coverage && node --experimental-strip-types --test-timeout 600000 --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test \"src/**/*.spec.ts\"","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"node --disable-warning ExperimentalWarning --experimental-strip-types --test-timeout 600000 --test \"src/**/*.spec.ts\"","lint":"eslint --max-warnings 0 .","lint:fix":"eslint . --fix","prepublishOnly":"npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","devDependencies":{"@checkdigit/eslint-config":"^11.1.0","@checkdigit/prettier-config":"^6.2.0","@checkdigit/typescript-config":"^9.0.0","rimraf":"^6.0.1"},"engines":{"node":">=22.11"}}
1
+ {"name":"@checkdigit/time","version":"5.0.0-PR.21-c1b2","description":"Standard time handling","homepage":"https://github.com/checkdigit/time#readme","bugs":{"url":"https://github.com/checkdigit/time/issues"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/time.git"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"rimraf coverage && mkdir coverage && node --experimental-strip-types --test-timeout 600000 --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test \"src/**/*.spec.ts\"","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"node --disable-warning ExperimentalWarning --experimental-strip-types --test-timeout 600000 --test \"src/**/*.spec.ts\"","lint":"eslint --max-warnings 0 .","lint:fix":"eslint . --fix","prepublishOnly":"npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","devDependencies":{"@checkdigit/eslint-config":"^11.1.0","@checkdigit/prettier-config":"^6.2.0","@checkdigit/typescript-config":"^9.0.0","rimraf":"^6.0.1"},"engines":{"node":">=22.11"}}
@@ -48,7 +48,7 @@ export const lightFormatters = {
48
48
 
49
49
  // AM or PM
50
50
  a(date: Date, token: string): string {
51
- // [PATCH:] this hack is required because setHours doesn't work for hours that are spring-forward
51
+ // [PATCH:] this hack is required because setHours doesn't work for hours that are close to daylight saving timezone threshold
52
52
  const dayPeriodEnumValue = ((date as any)[Symbol.for('UTCHours')] ?? date.getHours()) / 12 >= 1 ? 'pm' : 'am';
53
53
  // original:
54
54
  // const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
@@ -69,7 +69,7 @@ export const lightFormatters = {
69
69
 
70
70
  // Hour [1-12]
71
71
  h(date: Date, token: string): string {
72
- // [PATCH:] this hack is required because setHours doesn't work for hours that are spring-forward
72
+ // [PATCH:] this hack is required because setHours doesn't work for hours that are close to daylight saving timezone threshold
73
73
  return addLeadingZeros(((date as any)[Symbol.for('UTCHours')] ?? date.getHours()) % 12 || 12, token.length);
74
74
  // original:
75
75
  // return addLeadingZeros(date.getHours() % 12 || 12, token.length);
@@ -77,7 +77,7 @@ export const lightFormatters = {
77
77
 
78
78
  // Hour [0-23]
79
79
  H(date: Date, token: string): string {
80
- // [PATCH:] this hack is required because setHours doesn't work for hours that are spring-forward
80
+ // [PATCH:] this hack is required because setHours doesn't work for hours that are close to daylight saving timezone threshold
81
81
  return addLeadingZeros((date as any)[Symbol.for('UTCHours')] ?? date.getHours(), token.length);
82
82
  // original:
83
83
  // return addLeadingZeros(date.getHours(), token.length);
@@ -47,4 +47,5 @@ export function addDays<DateType extends Date, ResultDate extends Date = DateTyp
47
47
  _date.setDate(_date.getDate() + amount);
48
48
  return _date;
49
49
  }
50
+
50
51
  /* eslint-enable */
@@ -48,7 +48,7 @@ export function constructFrom<DateType extends Date | ConstructableDate, ResultD
48
48
 
49
49
  if (date && typeof date === 'object' && constructFromSymbol in date) {
50
50
  const dateToReturn = date[constructFromSymbol](value);
51
- // [PATCH:] this hack is required because setHours doesn't work for hours that are spring-forward
51
+ // [PATCH:] this hack is required because setHours doesn't work for hours that are close to daylight saving timezone threshold
52
52
  if ((value as any)[Symbol.for('UTCHours')] !== undefined) {
53
53
  (dateToReturn as any)[Symbol.for('UTCHours')] = (value as any)[Symbol.for('UTCHours')];
54
54
  }
@@ -57,7 +57,7 @@ export function constructFrom<DateType extends Date | ConstructableDate, ResultD
57
57
 
58
58
  if (date instanceof Date) {
59
59
  const dateToReturn = new (date.constructor as GenericDateConstructor<ResultDate>)(value);
60
- // [PATCH:] this hack is required because setHours doesn't work for hours that are spring-forward
60
+ // [PATCH:] this hack is required because setHours doesn't work for hours that are close to daylight saving timezone threshold
61
61
  if ((date as any)[Symbol.for('UTCHours')] !== undefined) {
62
62
  (dateToReturn as any)[Symbol.for('UTCHours')] = (date as any)[Symbol.for('UTCHours')];
63
63
  }
@@ -4,101 +4,7 @@
4
4
 
5
5
  // This file is generated automatically by `scripts/build/indices.ts`. Please, don't change it.
6
6
 
7
- export * from './af/index.ts';
8
- export * from './ar/index.ts';
9
- export * from './ar-DZ/index.ts';
10
- export * from './ar-EG/index.ts';
11
- export * from './ar-MA/index.ts';
12
- export * from './ar-SA/index.ts';
13
- export * from './ar-TN/index.ts';
14
- export * from './az/index.ts';
15
- export * from './be/index.ts';
16
- export * from './be-tarask/index.ts';
17
- export * from './bg/index.ts';
18
- export * from './bn/index.ts';
19
- export * from './bs/index.ts';
20
- export * from './ca/index.ts';
21
- export * from './ckb/index.ts';
22
- export * from './cs/index.ts';
23
- export * from './cy/index.ts';
24
- export * from './da/index.ts';
25
- export * from './de/index.ts';
26
- export * from './de-AT/index.ts';
27
- export * from './el/index.ts';
28
- export * from './en-AU/index.ts';
29
- export * from './en-CA/index.ts';
30
- export * from './en-GB/index.ts';
31
- export * from './en-IE/index.ts';
32
- export * from './en-IN/index.ts';
33
- export * from './en-NZ/index.ts';
34
7
  export * from './en-US/index.ts';
35
- export * from './en-ZA/index.ts';
36
- export * from './eo/index.ts';
37
- export * from './es/index.ts';
38
- export * from './et/index.ts';
39
- export * from './eu/index.ts';
40
- export * from './fa-IR/index.ts';
41
- export * from './fi/index.ts';
42
- export * from './fr/index.ts';
43
- export * from './fr-CA/index.ts';
44
- export * from './fr-CH/index.ts';
45
- export * from './fy/index.ts';
46
- export * from './gd/index.ts';
47
- export * from './gl/index.ts';
48
- export * from './gu/index.ts';
49
- export * from './he/index.ts';
50
- export * from './hi/index.ts';
51
- export * from './hr/index.ts';
52
- export * from './ht/index.ts';
53
- export * from './hu/index.ts';
54
- export * from './hy/index.ts';
55
- export * from './id/index.ts';
56
- export * from './is/index.ts';
57
- export * from './it/index.ts';
58
- export * from './it-CH/index.ts';
59
- export * from './ja/index.ts';
60
- export * from './ja-Hira/index.ts';
61
- export * from './ka/index.ts';
62
- export * from './kk/index.ts';
63
- export * from './km/index.ts';
64
- export * from './kn/index.ts';
65
- export * from './ko/index.ts';
66
- export * from './lb/index.ts';
67
- export * from './lt/index.ts';
68
- export * from './lv/index.ts';
69
- export * from './mk/index.ts';
70
- export * from './mn/index.ts';
71
- export * from './ms/index.ts';
72
- export * from './mt/index.ts';
73
- export * from './nb/index.ts';
74
- export * from './nl/index.ts';
75
- export * from './nl-BE/index.ts';
76
- export * from './nn/index.ts';
77
- export * from './oc/index.ts';
78
- export * from './pl/index.ts';
79
- export * from './pt/index.ts';
80
- export * from './pt-BR/index.ts';
81
- export * from './ro/index.ts';
82
- export * from './ru/index.ts';
83
- export * from './se/index.ts';
84
- export * from './sk/index.ts';
85
- export * from './sl/index.ts';
86
- export * from './sq/index.ts';
87
- export * from './sr/index.ts';
88
- export * from './sr-Latn/index.ts';
89
- export * from './sv/index.ts';
90
- export * from './ta/index.ts';
91
- export * from './te/index.ts';
92
- export * from './th/index.ts';
93
- export * from './tr/index.ts';
94
- export * from './ug/index.ts';
95
- export * from './uk/index.ts';
96
- export * from './uz/index.ts';
97
- export * from './uz-Cyrl/index.ts';
98
- export * from './vi/index.ts';
99
- export * from './zh-CN/index.ts';
100
- export * from './zh-HK/index.ts';
101
- export * from './zh-TW/index.ts';
102
8
  export type * from './types.ts';
103
9
 
104
10
  /* eslint-enable */
@@ -2,8 +2,8 @@
2
2
  /* eslint-disable */
3
3
  // @ts-nocheck
4
4
 
5
- import { type constructFromSymbol } from './constants/index.ts';
6
- import type { Locale } from './locale/types.ts';
5
+ import type { constructFromSymbol } from './constants/index.ts';
6
+ import { Locale } from './locale/types.ts';
7
7
 
8
8
  export type * from './locale/types.ts';
9
9
 
@@ -43,7 +43,7 @@ export function toZonedTime(date: Date | string | number, timeZone: string, opti
43
43
 
44
44
  resultDate.setHours(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
45
45
 
46
- // [PATCH:] this hack is required because setHours doesn't work for hours that are spring-forward
46
+ // [PATCH:] this hack is required because setHours doesn't work for hours that are close to daylight saving timezone threshold
47
47
  (resultDate as any)[Symbol.for('UTCHours')] = d.getUTCHours();
48
48
 
49
49
  return resultDate;
@@ -1,46 +0,0 @@
1
- // src/date-fns/_lib/test/index.ts
2
- import { afterEach, beforeEach } from "vitest";
3
- import { addLeadingZeros } from "../addLeadingZeros/index.mjs";
4
- import { setDefaultOptions } from "../defaultOptions/index.mjs";
5
- import sinon from "sinon";
6
- function assertType(_value) {
7
- }
8
- function resetDefaultOptions() {
9
- setDefaultOptions({});
10
- }
11
- function generateOffset(originalDate) {
12
- let offset = "";
13
- const tzOffset = originalDate.getTimezoneOffset();
14
- if (tzOffset !== 0) {
15
- const absoluteOffset = Math.abs(tzOffset);
16
- const hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
17
- const minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
18
- const sign = tzOffset < 0 ? "+" : "-";
19
- offset = `${sign}${hourOffset}:${minuteOffset}`;
20
- } else {
21
- offset = "Z";
22
- }
23
- return offset;
24
- }
25
- function fakeDate(date) {
26
- let clock;
27
- function fakeNow(date2) {
28
- clock?.restore();
29
- clock = sinon.useFakeTimers(+date2);
30
- }
31
- beforeEach(() => {
32
- fakeNow(+date);
33
- });
34
- afterEach(() => {
35
- clock?.restore();
36
- clock = void 0;
37
- });
38
- return { fakeNow };
39
- }
40
- export {
41
- assertType,
42
- fakeDate,
43
- generateOffset,
44
- resetDefaultOptions
45
- };
46
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vc3JjL2RhdGUtZm5zL19saWIvdGVzdC9pbmRleC50cyJdLAogICJtYXBwaW5ncyI6ICI7QUFJQSxTQUFTLFdBQVcsa0JBQWtCO0FBQ3RDLFNBQVMsdUJBQXVCO0FBQ2hDLFNBQVMseUJBQXlCO0FBQ2xDLE9BQU8sV0FBVztBQUVYLFNBQVMsV0FBaUIsUUFBYztBQUFDO0FBTXpDLFNBQVMsc0JBQTRCO0FBQzFDLG9CQUFrQixDQUFDLENBQUM7QUFDdEI7QUFHTyxTQUFTLGVBQWUsY0FBb0I7QUFFakQsTUFBSSxTQUFTO0FBQ2IsUUFBTSxXQUFXLGFBQWEsa0JBQWtCO0FBRWhELE1BQUksYUFBYSxHQUFHO0FBQ2xCLFVBQU0saUJBQWlCLEtBQUssSUFBSSxRQUFRO0FBQ3hDLFVBQU0sYUFBYSxnQkFBZ0IsS0FBSyxNQUFNLGlCQUFpQixFQUFFLEdBQUcsQ0FBQztBQUNyRSxVQUFNLGVBQWUsZ0JBQWdCLGlCQUFpQixJQUFJLENBQUM7QUFFM0QsVUFBTSxPQUFPLFdBQVcsSUFBSSxNQUFNO0FBRWxDLGFBQVMsR0FBRyxJQUFJLEdBQUcsVUFBVSxJQUFJLFlBQVk7QUFBQSxFQUMvQyxPQUFPO0FBQ0wsYUFBUztBQUFBLEVBQ1g7QUFFQSxTQUFPO0FBQ1Q7QUFFTyxTQUFTLFNBQVMsTUFBcUI7QUFDNUMsTUFBSTtBQUVKLFdBQVMsUUFBUUEsT0FBcUI7QUFDcEMsV0FBTyxRQUFRO0FBQ2YsWUFBUSxNQUFNLGNBQWMsQ0FBQ0EsS0FBSTtBQUFBLEVBQ25DO0FBRUEsYUFBVyxNQUFNO0FBQ2YsWUFBUSxDQUFDLElBQUk7QUFBQSxFQUNmLENBQUM7QUFFRCxZQUFVLE1BQU07QUFDZCxXQUFPLFFBQVE7QUFDZixZQUFRO0FBQUEsRUFDVixDQUFDO0FBRUQsU0FBTyxFQUFFLFFBQVE7QUFDbkI7IiwKICAibmFtZXMiOiBbImRhdGUiXQp9Cg==
@@ -1,9 +0,0 @@
1
- export declare function assertType<Type>(_value: Type): void;
2
- export declare namespace assertType {
3
- type Equal<T, U> = Exclude<T, U> extends never ? (Exclude<U, T> extends never ? true : false) : false;
4
- }
5
- export declare function resetDefaultOptions(): void;
6
- export declare function generateOffset(originalDate: Date): string;
7
- export declare function fakeDate(date: number | Date): {
8
- fakeNow: (date: number | Date) => void;
9
- };
@@ -1,61 +0,0 @@
1
- /* eslint-disable eslint-comments/no-unlimited-disable */
2
- /* eslint-disable */
3
- // @ts-nocheck
4
-
5
- import { afterEach, beforeEach } from 'vitest';
6
- import { addLeadingZeros } from '../addLeadingZeros/index.ts';
7
- import { setDefaultOptions } from '../defaultOptions/index.ts';
8
- import sinon from 'sinon';
9
-
10
- export function assertType<Type>(_value: Type) {}
11
-
12
- export namespace assertType {
13
- export type Equal<T, U> = Exclude<T, U> extends never ? (Exclude<U, T> extends never ? true : false) : false;
14
- }
15
-
16
- export function resetDefaultOptions(): void {
17
- setDefaultOptions({});
18
- }
19
-
20
- // This makes sure we create the consistent offsets across timezones, no matter where these tests are ran.
21
- export function generateOffset(originalDate: Date) {
22
- // Add the timezone.
23
- let offset = '';
24
- const tzOffset = originalDate.getTimezoneOffset();
25
-
26
- if (tzOffset !== 0) {
27
- const absoluteOffset = Math.abs(tzOffset);
28
- const hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
29
- const minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
30
- // If less than 0, the sign is +, because it is ahead of time.
31
- const sign = tzOffset < 0 ? '+' : '-';
32
-
33
- offset = `${sign}${hourOffset}:${minuteOffset}`;
34
- } else {
35
- offset = 'Z';
36
- }
37
-
38
- return offset;
39
- }
40
-
41
- export function fakeDate(date: number | Date) {
42
- let clock: sinon.SinonFakeTimers | undefined;
43
-
44
- function fakeNow(date: number | Date) {
45
- clock?.restore();
46
- clock = sinon.useFakeTimers(+date);
47
- }
48
-
49
- beforeEach(() => {
50
- fakeNow(+date);
51
- });
52
-
53
- afterEach(() => {
54
- clock?.restore();
55
- clock = undefined;
56
- });
57
-
58
- return { fakeNow };
59
- }
60
-
61
- /* eslint-enable */