datefmt: Define 1 year as 365.2425 days instead of 365.25
commit459fa037d7149b173de0dd516968a8fed22b89e4
authorØyvind A. Holm <sunny@sunbase.org>
Tue, 26 Sep 2023 15:22:52 +0000 (26 17:22 +0200)
committerØyvind A. Holm <sunny@sunbase.org>
Tue, 26 Sep 2023 15:22:52 +0000 (26 17:22 +0200)
treeb5bf5adfbfe8d7dcc62a9e4f5814801e0a2ed89e
parent300821e7a665970af0102acb8edc6ad2a48d0782
datefmt: Define 1 year as 365.2425 days instead of 365.25

According to sqlite3, it's much more accurate. For example:

    SQLite version 3.43.1 2023-09-11 12:01:27

    sqlite> select datetime(julianday('2023-09-26')-6000*365.25);
    -3977-08-12 00:00:00
    sqlite> select datetime(julianday('2023-09-26')-6000*365.2425);
    -3977-09-26 00:00:00

    sqlite> select datetime(julianday('2023-09-26')+7000*365.2425);
    9023-09-26 12:00:00
    sqlite> select datetime(julianday('2023-09-26')+7000*365.25);
    9023-11-18 00:00:00

I chose 365.25 days back in the day because it aligns with the
astronomical year, offers greater consistency with fewer fractions, and
is a widely accepted standard in scientific contexts. However, for
improved accuracy, it's better to use the Gregorian year rather than the
Julian year.

Here's the whole experiment session, compressed with gzip+base64:

H4sIAOzJ EmUCA93X 7WrbMBQG 4P++ChEG bRfsHR19 qzAYI4NB NxhjF+At 2uqROFns
Dnr3k91k sdTkR2UP yiAQMPjJ 66PjI+UF aX6tqtax 7POnG/9N frtdU21q wgrOCkoQ
kOVgckoJ RQvUosoW det2ZFbc utV2Rr5v duSuKX84 clvVbVNk bzd17b61 bknaDSlJ
uyvrpnJ1 S6o6X7v1 ZndPlmVb fi0bV2Rf GuelzdbV 5N37m8XH Nx8Ws+6+ neuv+SAl
2XaRmrYj jjc+xH5N GrfyP0Yu f96tqrJe lveXF4fM KC+u8sF1 ao7Xr64z JgWKAkZL
5BXxVIHi OqMAiaA+ AxpTGKNQ IuUGKUuy 1Wkbe5sL 5Gg0R5lk y9M2622q tORcSWaS
bDxtq87W TCjURqBS KTacXcAO VxqMooY9 on37ubZa u7M/4RsA Xj5gV522 f3kMAbD9
J0UcgH9j p4MYgIe+ ExOAPCRl PzGSSBaR 6vjYMr2O oQnjYw5N jExje/ZZ 5OSR6RtS
qbF9xINW 35M6R5VO moB88u0y TMT2iSim J5Jx5dgE lRMxikd0 zCsTojAB ihEKMMn8
GawSHM8X E4hTpkQW mgD7QUk9 qC3yEeZQ pJA+1P5R Sh42EgA9 lJPbfrCl oCJGcZ8U
0bLUp5cx etjNqLQc LNcJ71FY 0n4gH5Om 1XSIygil 3ApmQYxC eYD6hRIW meU4Cg1M
1XUU+qzq +T39ZOvE YxQneKFE jLIJkg5M ajwaBqXa d3/C0SNC w4biwgIf NaJ6FAYo
tdT/o9T/ 53SehyIH Lj3XiX55 UsXh3tl1 ay+m753z eO/k4/fO eXy+UeOP sPP4IKYn
yGki88mA HguoCDAT VEoFPdKL lOZUP6pT 9gff15M7 /BEAAA==

c1fbd928-5c80-11ee-ab26-83850402c3ce
datefmt
tests/datefmt.t