Hacker News new | past | comments | ask | show | jobs | submit login

A while back I wrote a calendaring application where I encountered a similar problem and came up with a similar solution. If someone scheduled an all day meeting that ended at 12 midnight, the calendar would show it as a two-day meeting. The meeting started at 12AM on January 8th and ended at midnight of the same day... but since January 8th ends at 11:59PM and January 9th begins one minute later, the invite would roll over and be displayed as ending the next day. I'm not actually a real programmer (I just pretend to be one when someone wants to pay me) so this took way longer to figure out than it really should have.

I tried various things like if a meeting says 12AM, subtract one day, but then I'd encounter edge cases like meetings that start at 12AM now showing the previous day, or meetings that are scheduled from 12AM on the 8th to 12AM on the 8th (basically zero-minute durations) showing the wrong day or a bunch more things you don't think of until you try to develop applications for end users you might never talk to.

Eventually I set it to make any meeting that ended at 12AM just subtract one minute from the overall duration so it would end at 11:59PM instead. It didn't as much solve the problem as it did just avoid it, but at least people stopped complaining.




Time is hard.

Doing it right is really hard.

Whether this is measuring time or calculating time, it's hard.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: