Computer
An AI Podcasting Machine Is Churning Out 3,000 Episodes a Week
Read more of this story at Slashdot.
NetChoice Sues Virginia To Block Its One-Hour Social Media Limit For Kids
Read more of this story at Slashdot.
Tech Giants' Cloud Power Probed As EU Weighs Inclusion In DMA
Read more of this story at Slashdot.
'Buy Now, Pay Later' is Expanding Fast, and That Should Worry Everyone
Read more of this story at Slashdot.
Harvard Has Almost Half a Billion Dollars in Crypto
Read more of this story at Slashdot.
Is Video Watching Bad for Kids? The Effect of Video Watching on Children's Skills
Read more of this story at Slashdot.
Iran Begins Cloud Seeding To Induce Rain Amid Historic Drought
Read more of this story at Slashdot.
AI Use in 'Call of Duty: Black Ops 7' Draws Fire From US Lawmaker
Read more of this story at Slashdot.
Take-Two CEO Says Consoles Aren't Going Away, But Gaming is Moving Toward PCs
Read more of this story at Slashdot.
UK Cyber Ransom Ban Risks Collapse of Essential Services
Read more of this story at Slashdot.
Global Web Freedoms Tumble
Read more of this story at Slashdot.
Why Hotel-Room Cancellations Disappeared
Read more of this story at Slashdot.
Anthropic CEO Says He's 'Deeply Uncomfortable' With Unelected Tech Elites Shaping AI
Read more of this story at Slashdot.
Florida Bill Would Require Cursive Instruction in Elementary Schools
Read more of this story at Slashdot.
Bezos Returns To CEO Role With AI Startup Project Prometheus
Read more of this story at Slashdot.
How Should the Linux Kernel Handle AI-Generated Contributions?
Read more of this story at Slashdot.
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.
