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

tzTokenizeDate: Remove weird unneeded regex #254

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

TheThing
Copy link
Contributor

According to my tests, format will never display unicode characters.
I ran through every single list of timezones in wikipedia (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) and not a single time did it ever produce a weird non-ascii output. In fact, putting all possible dtf.format(date) in a set and comparing it with:

var s = new Set()
/* run through every timezone and do s.add(dtf.format(d)) */
s.forEach(x => console.log(x, x === x.replace(/\u200e/g, '')))

Produced exactly the output you would expect:

10/24/2023, 24:00:00 true
10/24/2023, 03:00:00 true
10/24/2023, 01:00:00 true
10/24/2023, 02:00:00 true
10/23/2023, 15:00:00 true
10/23/2023, 16:00:00 true
10/23/2023, 20:00:00 true
10/23/2023, 21:00:00 true
10/23/2023, 19:00:00 true
10/23/2023, 18:00:00 true
10/23/2023, 17:00:00 true
10/23/2023, 22:00:00 true
10/23/2023, 21:30:00 true
10/24/2023, 11:00:00 true
10/24/2023, 07:00:00 true
10/24/2023, 10:00:00 true
10/24/2023, 05:00:00 true
10/24/2023, 13:00:00 true
10/24/2023, 06:00:00 true
10/24/2023, 12:00:00 true
10/24/2023, 04:00:00 true
10/24/2023, 08:00:00 true
10/24/2023, 05:30:00 true
10/24/2023, 09:00:00 true
10/24/2023, 04:30:00 true
10/24/2023, 05:45:00 true
10/24/2023, 06:30:00 true
10/24/2023, 03:30:00 true
10/23/2023, 23:00:00 true
10/24/2023, 10:30:00 true
10/24/2023, 09:30:00 true
10/24/2023, 08:45:00 true
10/24/2023, 13:45:00 true
10/23/2023, 14:00:00 true
10/24/2023, 14:00:00 true
10/23/2023, 14:30:00 true
10/23/2023, 13:00:00 true

There is no reason to run unecessary regex on ascii strings.

According to my tests, format will never display unicode characters. I ran through every single list of timezones in wikipedia and it never produced an output that would need regex replace.
@marnusw marnusw merged commit 2bae872 into marnusw:master Mar 6, 2024
4 checks passed
@marnusw
Copy link
Owner

marnusw commented Mar 6, 2024

That's great. Thank you for verifying this so thoroughly @TheThing.

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

Successfully merging this pull request may close these issues.

None yet

2 participants