Feed aggregator
Bitcoin Erases Year's Gain as Crypto Bear Market Deepens
Read more of this story at Slashdot.
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!
More Tech Moguls Want to Build Data Centers in Outer Space
Read more of this story at Slashdot.
Microsoft Executives Discuss How AI Will Change Windows, Programming -- and Society
Read more of this story at Slashdot.
Chinese Astronauts Return From Their Space Station After Delay Blamed on Space Debris Damage
Read more of this story at Slashdot.
Rust in Android: More Memory Safety, Fewer Revisions, Fewer Rollbacks, Shorter Reviews
Read more of this story at Slashdot.
Some Americans Are Trying to Heat Their Homes With Bitcoin Mining
Read more of this story at Slashdot.
Apple Speeds Planning for Replacing CEO Tim Cook Next Year
Read more of this story at Slashdot.
Deaths Linked to Antibiotic-Resistant Superbugs Rose 17% in England in 2024
Read more of this story at Slashdot.
The Internet Archive Now Captures AI-Generated Content (Including Google's AI Overviews)
Read more of this story at Slashdot.
Could Firefox Be the Browser That Protects the Privacy of AI Users?
Read more of this story at Slashdot.
Are Data Centers Raising America's Electricity Prices?
Read more of this story at Slashdot.
Security Researchers Spot 150,000 Function-less npm Packages in Automated 'Token Farming' Scheme
Read more of this story at Slashdot.
Solar and Wind are Covering ALl New Power Demand in 2025
Read more of this story at Slashdot.
'Holy Winamp! Opera Puts a Music Visualizer Inside Its Browser'
Read more of this story at Slashdot.
Could C# Overtake Java in TIOBE's Programming Language Popularity Rankings?
Read more of this story at Slashdot.
Copy-and-Paste Now Exceeds File Transferring as the Top Corporate Data Exfiltration Vector
Read more of this story at Slashdot.
Google Begins Aggresively Using the Law To Stop Text Message Scams
Read more of this story at Slashdot.
A Quantum Error Correction Breakthrough?
Read more of this story at Slashdot.
Fear Drives the AI 'Cold War' Between America and China
Read more of this story at Slashdot.
