Skip to content

Specific date with hour is parsed to null #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JuliusHenke opened this issue Aug 12, 2022 · 4 comments
Open

Specific date with hour is parsed to null #465

JuliusHenke opened this issue Aug 12, 2022 · 4 comments

Comments

@JuliusHenke
Copy link

I use chrono-node version 2.3.9. I ran some tests with different date formats and found a specific combination of date and hour to not work. I used parseDate("03-27-2022, 02:00 AM").

Results in null:
03-27-2022, 02:00 AM

Working as expected:
03-27-2022, 01:00 AM
03-27-2022, 03:00 AM
03-27-2022, 04:00 AM
...

03-27-2022, 01:00 PM
03-27-2022, 02:00 PM
03-27-2022, 03:00 PM
...

03-26-2022, 02:00 AM
03-28-2022, 02:00 AM

wanasit pushed a commit that referenced this issue Aug 13, 2022
@wanasit
Copy link
Owner

wanasit commented Aug 13, 2022

Hello. I cannot really reproduce the null result as reported (see. c3d2bd8).

Could you provide me with more information about how you run the library (the exact code, gist, or runnable example is preferable)?

@JuliusHenke
Copy link
Author

I made a minimal reproduction running a plain JavaScript file with Node.js v16.15.0.
https://github.com/JuliusHenke/chrono-issue-465-example

@wanasit
Copy link
Owner

wanasit commented Aug 21, 2022

@JuliusHenke I have tried your project using these exact commands:

git clone https://github.com/JuliusHenke/chrono-issue-465-example.git
cd chrono-issue-465-example
yarn install
node main.js

And got a normal result:

2022-03-26T17:00:00.000Z
2022-03-26T17:00:00.000Z
...

My node version is v18.6.0. It is not easy for me to change my current env. I'll try v16.15.0 if I have time.
On the other hand, is it possible for you to try updating your node (to >=v18.6.0)?

@JuliusHenke
Copy link
Author

JuliusHenke commented Aug 21, 2022

I did test node version v18.6.0, v16.15.0 and v14.20.0. All resulted in the first two logs being printed null.
But then I could pinpoint the issue to the system timezone in which node is running.

Issue occurs:

  • Timezone UTC +1 (e.g. Amsterdam, Berlin)

Issue does not occur:

  • Timezone UTC -3
  • Timezone UTC -2
  • Timezone UTC -1
  • Timezone UTC +0
  • Timezone UTC +2
  • Timezone UTC +3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants