Template talk:Gregorian serial date

Bug?
Something's odd with this. The most popular way to count days of the common era is day&#160;1&#160;=&#160;0001-01-01.

gives 736815

The only alternative I've ever heard of is to count days since 0001-01-01, therefore I expect to get 1 or 0 for this date, not -1. --&#160;Omniplex 08:17, 21 June 2006 (UTC)

I'm checking this against The Calendar Converter, It seems that todays serial is correct, but it's having trouble with 1/1/01. Proably something to do with leapyears.

Found the bug, It always subtracts a day to deal with February having less than 30 days. No exception was written if we haven't reached February yet this year.--God Ω War 16:40, 21 June 2006 (UTC)


 * Checking today
 * gives 736815
 * With REXX I get one less, that's fine, it counts days since 0001-01-01. --&#160;Omniplex 21:00, 21 June 2006 (UTC)

Test
gives 736815 gives 736815

Testing if we get away with &lt; 0 or really need &lt; 1. --&#160;Omniplex 22:21, 21 June 2006 (UTC) Nope, really wrong for March 1, 1 BC (= year 0). --&#160;Omniplex 22:24, 21 June 2006 (UTC)

This is why I put in the error message. Year 0 does not exist, that would be a B.C date which needs extra coding to handle.--God Ω War 23:53, 21 June 2006 (UTC)


 * Year 0 as we count it today is simply 1 BC, it certainly "exists" in a proleptic Gregorian calendar, like 199 AD exists (also proleptic). Apparently they tuned it to be in sync with Julian from 0200-03-01 up to 0300-02-28. If you have a clue why they didn't calibrate it for year 1 please add it somewhere to the articles, it's puzzling. Why the third century instead of the first? --&#160;Omniplex 01:57, 22 June 2006 (UTC)

Please replace &#123;{void|...}} with &#123;{ns:0|...}}
As &#123;{ns:0|xxx}} is now working as &#123;{void|xxx}}, then we should now replace all &#123;{void|...}} in this page with &#123;{ns:0|...}}, to avoid using customized template, and to use built-in MediaWiki features as much as possible. --Ans (talk) 05:22, 27 March 2009 (UTC)

Suggestion for better code
Please take a look at this code from the same template of Korean WP:

And code for subst:

Above codes are better than current version of this template, in every aspects. It uses no "#ifexpr:" parserfunction so it takes fewer server load with lower "preprocessor node count", uses floor instead of round(little expensive than floor), fixes problem with pre-epoch, and fixes the bug with its "trunc" calculation. And expanded month, day numbers are possible with this code, for example: (which means Mar. 1, 2000) or  (Dec. 1, 1999). --Alphanis (talk) 18:18, 28 May 2011 (UTC)

What are we counting?
January 13, 2013 will have GSD . In Julian calendar it would be the same as December 31, 2012. J. calendar wasn't reformed, it doesn't skip any leap years, so this day would be number (2012 × 365.25 =) 734883. It's because Proleptic Gregorian calendar was two days behind Julian calendar at year 1 AD. In 1582 Calendar Reform ten days were written of, so proleptic Gregorian calendar would be equivalent to Julian c. from March 200 to February 300 AD. Fictitious non-leap years 100 and 200 AD create two-day deficit. Perhaps this should be mentioned in documentation? --Olovni (talk) 22:41, 20 November 2011 (UTC)

Module:Age
I created Module:Age to fix some problems reported with Age in years and months, then experimented by adding some code to implement Age in days and Gregorian serial date. I do not know if this template has any performance issues, but if wanted, it could be replaced with the module. More information is at Module talk:Age. Johnuniq (talk) 10:04, 2 April 2013 (UTC)
 * I changed the template to use the module because it is better that dates be checked for validity.


 * Johnuniq (talk) 02:43, 1 May 2018 (UTC)