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

The isDate function returns false for some timezones (e.g. North American time zones) #2351

Closed
rantler opened this issue Jan 10, 2024 · 2 comments
Labels

Comments

@rantler
Copy link

rantler commented Jan 10, 2024

Describe the bug

When validating string date values such as '2010-01-01' using default options, the isDate function returns false when the timezone has been set to a North American timezone such as 'America/Los_Angeles', but returns true for the same date in European timezones such as 'Europe/Amsterdam'.

Examples

Example of issue in Node REPL:

$ node
Welcome to Node.js v18.16.1.
Type ".help" for more information.
> validator = require('validator')
// ...
> process.env.TZ = 'Europe/Amsterdam'
'Europe/Amsterdam'
> validator.isDate('2010-01-01', { format: 'YYYY-MM-DD', delimiters: ['/', '-'], strict: false })
true

> process.env.TZ = 'America/Los_Angeles'
'America/Los_Angeles'
> validator.isDate('2010-01-01', { format: 'YYYY-MM-DD', delimiters: ['/', '-'], strict: false })
false

Additional context
Validator.js version: 13.11.0
Node.js version: 18.16.1
OS platform: Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000

@rantler rantler changed the title The isDate function returns false for some timezone (e.g. North American time zones) The isDate function returns false for some timezones (e.g. North American time zones) Jan 10, 2024
@jgulledge19
Copy link

Looks like this is a duplicate of #2256

Have an issue with this as well.

@WikiRik
Copy link
Member

WikiRik commented Jan 12, 2024

Closing this as it's indeed a duplicate of #2256. It has been patched in the master branch, but not been released yet. @profnandaa had some issues with releasing the new version so that's not been done yet

@WikiRik WikiRik closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants