Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ISO date strings #38

Open
isaacharrisholt opened this issue Oct 17, 2024 · 0 comments
Open

Support ISO date strings #38

isaacharrisholt opened this issue Oct 17, 2024 · 0 comments

Comments

@isaacharrisholt
Copy link

Hello!

I ran into an issue recently where I wanted to parse some date strings (e.g. 2024-10-01) and assumed that birl.parse would handle them (that's on me - should've read the docs). It seems like there's no good way to get a Time (or Day) out of a value like this without some funky string shenanigans that seem a bit brittle.

Also, there doesn't seem to be a way to turn a Day into a Time without doing something like:

let assert Ok(time) = birl.parse("1970-01-01T00:00:00")
let time = birl.set_day(time, my_day)

It would be nice to be able to get a Time value from a date string (assuming 00:00:00 would be fine and pretty normal), so I suggest either:

  • Add standalone date parsing to birl.parse (which might be a nightmare)
  • Add a birl.parse_day function and a from_day function: fn(day: Day) -> Time

Happy to look into implementing these myself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant