globalizejs / globalizejs/globalize

parseDate sets the time forward by an hour for non DST date time

Open
#937 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.8k
Forks
585
PR merge metrics
No merged PRs in 30d

Description

Hello @rxaviers. `parseDate` seems to have an issue in parsing a non-DST date time. _The issue happens when the local machine's date is the same as the DST start date._ Following are the steps I followed to reproduce,
- Manually set the machine timezone to **Eastern Time(UTC - 5)** [I don't observe DST so had to do this manually]
- Manually set the machine date to **12**(Jan or Feb doesn't matter) [March 12th is when DST starts in 2023].
- Run the following code,
```
var en = Globalize( "en" );
var date = "3/2/2023, 2:00 AM";
en.parseDate(date, { skeleton: "yMdhm" });
```

> Expected result: **Thu Mar 02 2023 02:00:00 GMT-0500 (Eastern Standard Time)**
> Actual result: **Thu Mar 02 2023 03:00:00 GMT-0500 (Eastern Standard Time)**

Similarly for 24hours format,
```
var en = Globalize( "en" );
var date = "3/2/2023, 2:00 PM";
en.parseDate(date, { skeleton: "yMdhm" });
```

> Expected result: **Thu Mar 02 2023 14:00:00 GMT-0500 (Eastern Standard Time)**
> Actual result: **Thu Mar 02 2023 15:00:00 GMT-0500 (Eastern Standard Time)**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.