Survivor 'relieved' after rapist, 22, sent to prison for five years
Heart-stopping helicopter rescue of BASE jumper dangling from Utah canyon by their rainbow parachute is caught on camera
No jobs... and no incentive to keep one in Labour's Britain: Parents left in tears by childcare costs say they'd be better off with no job - and graduates struggle as youth unemployment spirals
Representative Line: In the Zone
Robert R picked up a bug in his company's event scheduling app. Sometimes, events were getting reported a day off from when they actually were.
It didn't take too long to find the culprit, and as is so often the case, the culprit was handling dates with strings.
const dateAsString = event.toISOString().substr(0,10); return new Date(dateAsString);toISOString returns a "simplified" ISO8601 string, which looks like this: YYYY-MM-DDTHH:mm:ss.sssZ. The substr pops off the first ten characters, giving you YYYY-MM-DD.
The goal, as you can likely gather, is to truncate to just the date part of a date-time. And given that JavaScript doesn't have a convenient method to do that, it doesn't seem like a terrible way to solve that problem, if you don't think about what date-times contain too hard.
But there's an obvious issue here. toISOString always converts the date to UTC, converting from your local timezone to UTC. Which means when you pick off just the date portion of that, you may be off by an entire day, depending on the event's scheduled time and your local timezone.
This code doesn't simply truncate- it discards timezone information. But for an event scheduler used across the world, tracking timezones is important. You can't just throw that information away.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!
Developer made one wrong click and sent his AWS bill into the stratosphere
Who, Me? Welcome to another week of work, a moment The Register celebrates with a new installment of Who, Me? It's the reader-contributed column in which you 'fess up to follies, false moves, and faux pas – and explain how you escaped.…
Demi Moore, 63, reveals remarkably fuller features as she joins her co-stars on the red carpet at the Landman season two premiere in London
Ariana Grande stuns at Governors Awards as she hits first red carpet since being ambushed by crazed fan
Jennifer Lopez showcases hourglass figure in stunning gown at 16th Governors Awards
Family of Jesse Jackson say civil rights leader 'not on life support' despite reports
Essex radio presenters slam firm's 'embarrassing' late or missing payments
More Tech Moguls Want to Build Data Centers in Outer Space
Read more of this story at Slashdot.
Server virtualization market heats up as VMware rivals try to create alluring alternatives
The market for server virtualization tools is about to fragment, according to analyst firm Gartner.…
Hospital blood-takers strike for 236 days in 'longest walkout in NHS history'
The Essex area with stunning coastal views named among the best for first time house buyers
Trump fans the conspiracy theory flames as he says 'they' added things to Epstein files after the election
Tina Knowles mourns death of Beyonce fan who died by suicide at 25
Men with prostate cancer to be offered video calls with consultants and DIY home blood tests in major shakeup of NHS care
Savile Row tailors forced to repeatedly remake high-end suits as customers on weight-loss jabs shrink between fittings
Jaguar Land Rover hack cost India's Tata Motors around $2.4 billion and counting
Asia In Brief India’s Tata Motors, owner of Jaguar Land Rover, has revealed the cyberattack that shut down production in the UK has so far cost it around £1.8 billion ($2.35 billion).…