std.datetime

drug via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 10 08:06:53 PST 2017


10.02.2017 18:02, Jonathan M Davis via Digitalmars-d-learn пишет:
> On Friday, February 10, 2017 14:35:28 drug via Digitalmars-d-learn wrote:
>> I found error - years should start from 1, not 0.
>> But if months or days start from 0 std.datetime throws exception and
>> don't for years - it isn't clear that zero year is negative one (in that
>> mean that stdTime for '0000' years will be negative.
>
> As the documentation states in multiple places, std.datetime follows ISO
> 8601, which uses the Proleptic Gregorian Calendar, and that specifies that
> the year 0 is equivalent to what you would normall consider to be 1 B.C.
> And that's part of the spec for the ISO extended format that
> fromISOExtString uses.
>
> Now, while it is mentioned in multiple places that std.datetime follows ISO
> 8601 and that it follows the Proleptic Gregorian Calender (even providing a
> link to wikipedia), it does look like it fails to specifically mention that
> on the primary ddoc comment of SysTime. So, that should be improved.
> However, the documentation for SysTime.year does state that positive years
> are A.D., whereas non-positive are B.C. So, the information is there, even
> without having to look up the Proleptic Gregorian Calender or ISO 8601.
>
> What would have made it clearer for you?
>
> - Jonathan M Davis
>
Is zero positive or negative? May be add statement that zero year is 1 B.C.?
Thank you for your good job!


More information about the Digitalmars-d-learn mailing list