Conversation
tingerrr
left a comment
There was a problem hiding this comment.
Should probably apply the formatter here. I'm unsure about the date coercions, they seem a little overly fault-tolerant, I think we should only allow ISO format strings to be valid, no numbers as strings or numbers only/
| if (type(it) == type(datetime.today())) { | ||
| return it | ||
| } | ||
| if (type(it) == int) { |
There was a problem hiding this comment.
Really unsure about this one, seems more surprising than useful to me.
There was a problem hiding this comment.
This was just a file being moved, definitely worth being looked at but I'm not sure if its for this PR (which deals with just the version coercion).
On the topic of datetime parsing, I think dictionaries should be supported, on ISO formats, ISO 8601? I wouldn't support offsets but other than that, that should be doable
There was a problem hiding this comment.
Yeah, dictionaries sound fine to me.
ISO 8601?
Yeah, the full year, full month and full day must be specified for a string to be a valid date, i.e. "07" or "30-5" are rejected, because they are ambiguous, "1970-01-01" or "1970-1-1" are valid. No further checks like checking for the max day of month, that's up to the impl of datetime and more complicated than necessary.
A coercion that naively coerces ints, arrays of ints or strings, or strings, into version.