Issue parsing sqlite timestamps
Hello! I was testing out the package (version 1.8.0) when I noticed there is an issue parsing timestamps that are created in sqlite3.
See the following code snippet for details
let time1 = "2025-01-16 13:20:19" // default format for sqlite timestamps `current_timestamp`
let time2 = "2025-01-16T13:20:19.502Z" // correctly formatted iso6801 string
let assert Ok(v1) = birl.parse(time1)
io.debug(birl.to_iso8601(v1))
// "2025-01-01T00:00:00.000-01:06"
let assert Ok(v2) = birl.parse(time2)
io.debug(birl.to_iso8601(v2))
// "2025-01-16T13:20:19.502Z"
As you can see, parsing a timestamp in "2025-01-16 13:20:19" format results in an Ok result but the date and time are wrong. I would expect this parse to fail and return an error result.
Also facing similar issue. (Possible duplicate of #38)
I looked at codebase, and saw that it's trying to parse string and individually deriving the components of time.
How about providing a wrapper around strptime for parsing, and maybe similar strftime for formatting. It has been around for quite sometime, and is prevalent in other ecosystem as well.
Ref:
- linux man page
- python strptime
- ruby strptime
I can probably try a PoC PR on this, but wanted to know your thoughts on it @massivefermion ?
Quick googling around did highlight the fact that the
Cimplementation of these utility depends on machine