Skip to content
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

Alpine date parsing broken (invalid character set) #1811

Closed
SimonRosenau opened this issue Nov 16, 2022 · 2 comments
Closed

Alpine date parsing broken (invalid character set) #1811

SimonRosenau opened this issue Nov 16, 2022 · 2 comments

Comments

@SimonRosenau
Copy link

Environment

  • Platform: Tested on MacOS & Ubuntu
  • Docker Version: Docker Desktop 4.12.0 (85629); Engine-Version: 20.10.17
  • Node.js Version: v19.1.0
  • Image Tag: node:alpine

Expected Behavior

Serializing a date and then parsing it again should work in alpine docker images:

(base) Simon@Mac-Pro ~ % docker run -it node:18
Welcome to Node.js v18.12.1.
Type ".help" for more information.
> new Date(new Date().toLocaleString('en-US', { timeZone: 'Europe/Berlin' }))
2022-11-16T14:25:30.000Z
> .exit
(base) Simon@Mac-Pro ~ % docker run -it node:alpine 
Welcome to Node.js v19.1.0.
Type ".help" for more information.
> new Date(new Date().toLocaleString('en-US', { timeZone: 'Europe/Berlin' }))
2022-11-16T14:25:30.000Z
> .exit

Current Behavior

Serializing a date and then parsing it again breaks in alpine images and returns an invalid date:

(base) Simon@Mac-Pro ~ % docker run -it node:18
Welcome to Node.js v18.12.1.
Type ".help" for more information.
> new Date(new Date().toLocaleString('en-US', { timeZone: 'Europe/Berlin' }))
2022-11-16T14:25:30.000Z
> .exit
(base) Simon@Mac-Pro ~ % docker run -it node:alpine 
Welcome to Node.js v19.1.0.
Type ".help" for more information.
> new Date(new Date().toLocaleString('en-US', { timeZone: 'Europe/Berlin' }))
Invalid Date
> .exit

Possible Solution

Switch away from alpine docker image

Steps to Reproduce

(base) Simon@Mac-Pro ~ % docker run -it node:alpine 
Welcome to Node.js v19.1.0.
Type ".help" for more information.
> new Date(new Date().toLocaleString('en-US', { timeZone: 'Europe/Berlin' }))
Invalid Date
> .exit

Additional Information

Upon inspection of the serialized string it seems that the alpine version uses the 8239 whitespace instead of 32.:

Expected:
'[49,49,47,49,54,47,50,48,50,50,44,32,50,58,50,56,58,49,50,32,80,77]'
Actual:
'[49,49,47,49,54,47,50,48,50,50,44,32,50,58,50,56,58,49,50,8239,80,77]'

@nschonni
Copy link
Member

You're 2 examples are comparing Node 18 and 19, not just regular vs Alpine. This would still probably need to be reported upstream, as there isn't anything in this repo that would be able to address this

@SimonRosenau
Copy link
Author

@nschonni You're right - its indeed caused by node 19 and not specifically by the alpine build. Also seems like its already being tracked by nodejs/node#45171 so no need for this issue 🙂

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