The reason it apparently feels weird to many people to have months be zero indexed is that months are often referred to by their ordinal number, and ordinal numbers obviously start at 1.
What do you mean by “often”? Humans always use ordinal numbers for counting things like months, days, weeks, etc. There is no concept of 0 to be applied here, except for programming array indexing purposes.
This is a potential cause for confusion when writing computer code, because it’s very common for code to refer to items in a collection starting at zero.
Date & time APIs must match local reality.
https://mobile.twitter.com/hillelogram/status/13292284196289...
https://maggiepint.com/2017/04/09/fixing-javascript-date-get...
parseInt('0700') returns 700. But parseInt('0x700') will be parsed as octal, so now it's just a more subtle gotcha.
Loose parsers (such as parseInt(), and Date.parse() in JS) are one of the worst ideas ever. Nothing like tracing a bug, and finding that a junior dev is trying to parse DD/MM/YYYY strings using Date.parse(), except that instead of throwing on trying to parse an incorrect [non-RFC] format, the parser makes a best-guess and propagates an incorrect date because it was parsed as MM/DD/YYYY.
For instance, RFC 1945 (HTTP 1.0) specifies three acceptable date formats. Add ISO dates, and now you're writing software that needs to handle 4 different formats. Easier to just use a heuristic parser that's capable of accepting HTTP, email, Usenet, and ISO timestamps.
Fortunately, these days it's generally considered a bad idea to use anything but ISO timestamps, with the exception of a former colleague who tried arguing that DD/MM/YYYY was an acceptable format to be transmitting and storing dates in.
Parsing floating point values correctly is not a trivial amount of work - to the extent that there have any been security vulnerabilities in implementations.
That is, if I do this
float f = 123.456;
Console.WriteLine(“value is “+f);
The output shouldn’t vary depending on whether it’s run in France or the US (which it does by default).For parsing, the argument should even be explicitly required I think. So
float f = Float.Parse(“1,23”, frenchLocale);
So that it’s not ever forgotten or the reader has to wonder if the author forgot it.Otherwise I agree with you whole heartedly - I have been stung by absurd locale dependent behaviour in the past (windows’ font loading APIs inexplicably translate the font variant in the programmatic api)
Same with dates. Don't try lots of formats on an arbitrary string, force the user to specify the expected format somehow.