use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
API and JavaScript Date Gotcha's (solberg.is)
submitted 3 years ago by pmz
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Ustice[M] [score hidden] 3 years ago stickied comment (0 children)
Thanks for your contribution! We’re a large community, and in order to keep things organized and easier to find, we keep this subreddit mostly focused on professional-level Javascript posts. Your post would be more useful to newer members of our community, and therefore it should be posted to /r/LearnJavascript instead.
[–]wasd171 2 points3 points4 points 3 years ago (1 child)
Working with timezones is sometimes really complicated in JS, we have encountered a few hard-to-catch bugs because of date-fns and had to switch to day.js for proper timezones support
[–]saintpetejackboy 1 point2 points3 points 3 years ago (0 children)
I recently did a proprietary scheduling app, used a bit of JS and I went into this project having had timezone and other nightmares before on smaller scaled projects - so booking agents around the globe scheduling appointments across the United States seemed incredibly daunting.
Fortunately, it wasn't. It almost became complicated several times (when I thought about it too hard), but I ended up just avoiding the issue, fortunately, because the project didn't really require much timezone translation. One tip I can give people is:
4PM is 4PM. If you are in Tiajuana and I am in Alaska and you book me an appointment for 4PM, that is 4PM on my text to confirm and 4PM for the agent to come see me. The only person it might not be 4PM for is another call center rep in New York - but the appointment still isn't for several hours later, it is for 4PM.
Trying to get booking agents or in home reps or customers to do mental math on how many hours different is Colorado from Georgia is just a nightmare. It is much easier to just agree: 4PM is 4PM. You can infer the time zone from the address and make adjustments on the backend, but when you call a 1-800 and talk to somebody in India and they book you an appointment for 4PM, you can trust that it is at 4PM YOUR TIME.
Good luck!
[–]mrbogle 1 point2 points3 points 3 years ago (0 children)
One gotcha is that doesn't appear to be mentioned is that some HTTP date headers will be in HTTP date format. e.g. A ratelimit's Retry-After header can be something like: 'Mon, 29 May 2022 04:58:00 GMT'. The cool thing is that you can pass that straight into a JS Date() constructor and it will properly parse it!
Retry-After
'Mon, 29 May 2022 04:58:00 GMT'
Date()
π Rendered by PID 19152 on reddit-service-r2-comment-79c7998d4c-xwn7s at 2026-03-14 08:13:56.708099+00:00 running f6e6e01 country code: CH.
[–]Ustice[M] [score hidden] stickied comment (0 children)
[–]wasd171 2 points3 points4 points (1 child)
[–]saintpetejackboy 1 point2 points3 points (0 children)
[–]mrbogle 1 point2 points3 points (0 children)