XXIIVV / oscean

Static wiki engine written in Uxntal
http://wiki.xxiivv.com
MIT License
488 stars 81 forks source link

Arvelie cannot represent time before y2k #62

Open octref opened 3 years ago

octref commented 3 years ago

I'd like to use arvelie to denote moment in the past or future.

Time such as 02A01 refers to 2002-01-01, but 1902-01-01 finds no representation in arvelie.

neauoire commented 3 years ago

If you need to point to addresses in another century, you will need to use the 1902A01 format. Is that something that you need implemented in the arvelie.h file? I could add support for that if you're using it.

octref commented 3 years ago

Thanks for the quick answer! I'm implementing a JS version (EDIT: https://github.com/octref/arvelie) to use it on my own website. I compiled the reference C library, and also notice that:

 arvelie > ./arvelie 03+01
Error: Invalid arvelie date (Expecting 2003-12-31)
 arvelie > ./arvelie 20+02
Error: Invalid arvelie date (Expecting 2020-02-29)

Is that something that you need implemented in the arvelie.h file? I could add support for that if you're using it.

It seems you are handling input of length 5 and 10, so handling input of length 7 would be great, as it must be an arvelie date with full year. I can also send a PR myself.

octref commented 3 years ago

I have a patch that makes it work this way:

> ./arvelie 1920A01   
1920-01-01
# if year is not 20xx, use full arvelie format
> ./arvelie 1920-01-01
1920A01

Does that look fine to you? If so I'll send a PR.

neauoire commented 3 years ago

as long as it doesn't break compat with the current format sure :)