Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I only read the question and am not aware what domain/language this is coming from.

It seems they’re talking about Instants with different resolutions.

My answers are no, no, and yes.

If we see what they’re calling date as integers and times as floats, the questions become

Is 4 equal to 4.5? No

Is 4 between 4.5 and 200.5? No

Is 4.5 after 4? Yes



Is today equal to lunchtime? No, but also yes. "Today's lunch happens today" is a true statement, but "Today happens at lunch" is nonsensical.

Is today lunch and a few months from now? No, but also yes. Parts of today are, but the entire "today" isn't within that window.

Is today's lunch after today? No! It's during today, not tomorrow or some other future day. But also yes! Lunch happens after the calendar has flipped to today.

So we got Instants, Calendar Objects ("days", "weeks", etc), Durations, etc. Depending on context you could want some set operators to determine unions and intersections, or maybe you want simple numeric operators.


To me the main point of the tweet seems to be that either:

- what is assumed as "today" was a range and the fact that the question is asked is a sign something got really wrong down the chain. So the question has no answer.

- it is assumed that "today" is a time. If the exact time value existed but was cut off at some point, we're again in a "no answer" situation. The only way this can be answered is if the date is implicitly a time at midnight.

To me too, the only proper answer is "no,no,yes" and any other context is a "what happened?"


"4" is, in most contexts, implicitly a representation of "4.0".

"2022-02-12" is not always implicitly a representation of "2022-02-12 00:00:00".

Sometimes granularity is omitted because it is zero, and sometimes granularity is omitted because it doesn't exist.

(and sometimes granularity that doesn't exist is represented as zero due to encoding limitations/mistakes).


My intuition is that a "date" is a bounded range of times 24 hours long. So we should speak about dates containing times, or dates subsetting, supersetting, or intersecting other time ranges.


Um, add in a daylight savings transition and that "date" could be 23 or 25 hours long.

And that is not even getting into what a day means when you are trying to coordinate between NZ and the UK.


To really get confusing, let's add in leap seconds. They're added "as needed" and it looks like our most recent one was in 2016.

https://en.wikipedia.org/wiki/Leap_second


Good point! ISO 8601 dates should support timezones. Then a 24-hour "date" could only be in one of standard time or daylight time.


I agree with you except on point 3. 4.5 is not beyond 4 because to me 4 represents the complete window of "4-5". 4.5 is neither before nor after it, it's within.




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

Search: