Live data from Hacker News

Dates That Don't Exist (2015)

blog.yossarian.net

41–50 of 90 posts

Re: Dates That Don't Exist (2015)

#41
post #32

I'm the author of the Perl DateTime library. It works correctly as _documented_. Here's the first two paragraphs of the docs: > DateTime is a class for the representation of date/time combinations, and is part of the Perl DateTime project. > It represents the Gregorian calendar, extended backwards in time before its creation (in 1582). This is sometimes known as the "proleptic Gregorian calendar". In this calendar, t…

Who else uses the proleptic Gregorian calendar other than programmers of datetime libraries?

Who writes computer programs that deal with pre-1582 _dates_ at all?

In science-related code, I can image a case for calculating things like seconds elapsed across a very long time period. But in that case you're not really dealing with dates. Instead, you want something like the Unix epoch, but probably with an earlier epoch start.

There may be some very niche cases for pre-1582 dates in code that I'm not thinking of. But I'd expect that in this case you're going to put a lot of effort into finding the right libraries, or you might just write your own code.

Regardless, the linked blog post says of DateTime: "Unfortunately, like Python, a proper error message for impossible Gregorian dates is notably absent."

But this is just wrong. There's no "proper error message" to emit. The code works as documented.

Re: Dates That Don't Exist (2015)

#42
Using the proleptic Gregorian calendar for historical dates is only a problem if you want to compute the day of the week (which those missing days will throw off prior to the adoption of the Gregorian calendar in the relevant country) or the number of days between two historical dates (if the two dates span the date when the Gregorian calendar was adopted).

And, frankly, there are other problems to deal with beyond correctly handling the Julian/Gregorian switch. In Nelson's Navy, for example, the new day started at noon rather than midnight as we'd expect. AM could be June 1st, PM could be June 2nd, and both could be Tuesday.

And then there are lots of historical events with dates like "on or about August 6th" or "mid-September" or the "in the Fall of".

Trying to deal with historical dates in what a programmer would consider a perfectly correct way is something of a fool's game.

Re: Dates That Don't Exist (2015)

#43
post #32

I'm the author of the Perl DateTime library. It works correctly as _documented_. Here's the first two paragraphs of the docs: > DateTime is a class for the representation of date/time combinations, and is part of the Perl DateTime project. > It represents the Gregorian calendar, extended backwards in time before its creation (in 1582). This is sometimes known as the "proleptic Gregorian calendar". In this calendar, t…

Who else uses the proleptic Gregorian calendar other than programmers of datetime libraries?

It's typically not used in modern historical writing when referring to events located in areas that used the Julian calendar at that time.

But it is typically used when referring to events located in areas with no calendar system familiar to modern readers, most notably the Maya calendar. Maya Long Count dates are typically converted to the proleptic Gregorian calendar.

Also, many modern historical writings will display both Julian and Gregorian dates, particularly for dates around when the calendars were changing or when context is unclear (e.g. a historical figure who was born in an area with one calendar and died in an area with another calendar).

Re: Dates That Don't Exist (2015)

#44
post #41

Earlier quoted context omitted.

Who else uses the proleptic Gregorian calendar other than programmers of datetime libraries?

Who writes computer programs that deal with pre-1582 _dates_ at all? In science-related code, I can image a case for calculating things like seconds elapsed across a very long time period. But in that case you're not really dealing with dates. Instead, you want something like the Unix epoch, but probably with an earlier epoch start. There may be some very niche cases for pre-1582 dates in code that I'm not thinking o…

Most applications don't have to worry about it, but platforms do. The SQL standard requires accurate date representation for years 0000-9999. I was surprised to learn about the Gregorian shift while testing our database system. I also learned about "war time" in WW2 and the "battle of the clocks" in colonial India. A lot of history came out of debugging those tests.

Re: Dates That Don't Exist (2015)

#45
post #7

Earlier quoted context omitted.

Contracts and other similar types of financial instruments existed by this time there must be some way they handled it because something that said that it happened on a date that never occurred - sounds like what lawyers live for. I’ll draft a Dubia so that when future popes change the calendar they will include a representative code sample and details about how we handle this. (It’s important to remember that the po…

If a contract dated to the 4th October 1582 specifies you have 15 days to make payment, you would indeed need to know where that contract was signed to determine on what day that deadline expired. And if there is a contract dated to the 6th October 1582, that does raise questions about its legitimacy (though in general misdating a contract does not void it, it would merely be one point of evidence in your argument th…

I assume there is a way to handle this in modern contract law. Surely people have forgotten how long the various months are and written contracts referring to April 31.

Re: Dates That Don't Exist (2015)

#46
post #41

Earlier quoted context omitted.

Who else uses the proleptic Gregorian calendar other than programmers of datetime libraries?

Who writes computer programs that deal with pre-1582 _dates_ at all? In science-related code, I can image a case for calculating things like seconds elapsed across a very long time period. But in that case you're not really dealing with dates. Instead, you want something like the Unix epoch, but probably with an earlier epoch start. There may be some very niche cases for pre-1582 dates in code that I'm not thinking o…

> Who writes computer programs that deal with pre-1582 _dates_ at all?

People writing knowledge base software, like Wikidata. It's helpful to be able to display historical dates in any desired calendar, and also to be able to do date arithmetic between any two arbitrary dates.

Re: Dates That Don't Exist (2015)

#47
> In essence, then, those ten days in 1582 never happened and simply do not exist within the Gregorian calendar system used almost universally in the West today.

I find these things so much easier to think about if you consider the change as a change from one calendar system to another calendar system. Those 10 days certainly exist, in both calendar systems, they just represent different points in time. I.e., I think it's easier to just consider both calendar systems as the rules, extended forward & backwards infinitely ("proleptic"). Some people switched from a Julian calendar to a Gregorian one in 1582.

"Some people did not experience days with these labels in some areas of the world" … I get where it's coming from, but it's not how I'd build a library.

If you worry about the switch, then you have to ask "which switch?" which TFA only lightly touches on. The 1582 one is famous, of course, but not everyone switched, and other parts of the worlds switched as time went on, to as late as 1918, when Russia switched.[1] (And you can see other messiness in that table, too.)

Needing to deal with it is niche enough that I think most language std libs should implement the proleptic Gregorian calendar, and let an application whose niche requires it deal with the switch (& whichever switch it requires).

[1] https://en.wikipedia.org/wiki/List_of_adoption_dates_of_the_...

Re: Dates That Don't Exist (2015)

#48
post #44
post #41

Earlier quoted context omitted.

Who writes computer programs that deal with pre-1582 _dates_ at all? In science-related code, I can image a case for calculating things like seconds elapsed across a very long time period. But in that case you're not really dealing with dates. Instead, you want something like the Unix epoch, but probably with an earlier epoch start. There may be some very niche cases for pre-1582 dates in code that I'm not thinking o…

Most applications don't have to worry about it, but platforms do. The SQL standard requires accurate date representation for years 0000-9999. I was surprised to learn about the Gregorian shift while testing our database system. I also learned about "war time" in WW2 and the "battle of the clocks" in colonial India. A lot of history came out of debugging those tests.

For sure. I was thinking more of "normal" applications, as opposed to things like SQL databases. It looks like the SQL standard explicitly calls for the use of the Gregorian calendar for dates, so I think that answers the previous question of "Who else uses the proleptic Gregorian calendar other than programmers of datetime libraries?"

Re: Dates That Don't Exist (2015)

#49

This is an interesting detail to learn about history. However, like the article mentions near the end, the Gregorian calendar was adopted at different times in different countries. The Anglican Church didn’t trust the Catholics, so Great Britain adopted the Gregorian calendar in 1752 ( https://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750 ). And they did their best to hide the fact that they were adopting a Cat…

The British (including the American colonies) also did an arguably even more confusing calendar change in 1752, by switching the start of the new year from March 25 to January 1.

Re: Dates That Don't Exist (2015)

#50

> In essence, then, those ten days in 1582 never happened and simply do not exist within the Gregorian calendar system used almost universally in the West today. I find these things so much easier to think about if you consider the change as a change from one calendar system to another calendar system. Those 10 days certainly exist, in both calendar systems, they just represent different points in time. I.e., I think…

Messiness is an understatement :)

Thanks. I haven’t known that countries switched in different years.

Gregorian calendar is just one piece.

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

Eighteen countries use another calendar alongside the Gregorian calendar…

Post reply on HN