You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, in the US, when local standard time is about to reach Sunday, 14 March 2021, `02:00:00` clocks are turned`forward` 1 hour to Sunday, 14 March 2021, `03:00:00` local daylight time instead. Thus there is no `02:00:00` to `02:59:59` on 14 March 2021. In such edge cases, `parseTZ()` will parse like this:
384
+
For example, in the US, when local standard time is about to reach `02:00:00` on Sunday, 14 March 2021, the clocks are set`forward`by 1 hour to `03:00:00` local daylight time instead. As a result, the time from `02:00:00` to `02:59:59` on 14 March 2021 does not exist. In such edge cases, `parseTZ()` will handle the case in the following way:
Also, when local daylight time is about to reach Sunday, 7 November 2021, `02:00:00` clocks are turned `backward`1 hour to Sunday, 7 November 2021, `01:00:00` local standard time instead. Thus `01:00:00` to `01:59:59` on November 7 2021 is repeated twice. Since there are two possible times here, `parseTZ()` assumes that the time is the former (DST) in order to make the result unique:
397
+
Also, when local daylight time is about to reach `02:00:00` on Sunday, 7 November 2021, the clocks are set `back` by 1 hour to `01:00:00` local standard time instead. As a result, the time from `01:00:00` to `01:59:59` on 7 November 2021 occurs twice. Because this time period happens twice, `parseTZ()` assumes that the time is the earlier one (during DST) in order to make the result unique:
396
398
397
399
```javascript
398
400
// This time is DST or PST? The parseTZ() always assumes that it is DST.
Copy file name to clipboardExpand all lines: README.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,17 +25,17 @@ npm i date-and-time
25
25
26
26
## Recent Changes
27
27
28
+
- 3.6.0
29
+
- In `parseTZ()`, enabled parsing of the missing hour during the transition from standard time to daylight saving time into a Date type.
30
+
- In `format()` with the `z` token, fixed an issue where some short time zone names were incorrect.
31
+
28
32
- 3.5.0
29
33
- Added `addYearsTZ()`, `addMonthsTZ()`, and `addDaysTZ()` to the `timezone` plugin.
30
34
- Revised the approach to adding time and removed the third parameter from `addHours()`, `addMinutes()`, `addSeconds()`, and `addMilliseconds()`.
31
35
32
36
- 3.4.1
33
37
- Fixed an issue where `formatTZ()` would output 0:00 as 24:00 in 24-hour format in Node.js.
34
38
35
-
- 3.4.0
36
-
- Added `zz` (time zone name) and `z` (time zone name abbreviation) tokens to the `timezone` plugin.
37
-
- Fixed an issue where token extensions by other plugins were not reflected in functions provided by the `timezone` plugin.
38
-
39
39
## Usage
40
40
41
41
- ES Modules:
@@ -69,6 +69,16 @@ import date from '/path/to/date-and-time.es.min.js';
69
69
### Note
70
70
71
71
- If you want to use ES Modules in Node.js without the transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.
72
+
- If you are using TypeScript and having trouble building, please ensure that the following settings in the `compilerOptions` of your `tsconfig.json` are set to `true`.
0 commit comments