-
Notifications
You must be signed in to change notification settings - Fork 12
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
Type Time and NaiveTime differently #30
Comments
For another example, without running tests or knowing the implementation, can anyone guess what this will return: let assert Ok(t) = birl.parse("2019-01-01T14:00:00.003")
birl.get_offset(t)
|> io.debug The result is |
As has been mentioned in #29, this is a bug in |
Hey! This issue and the want for easy decision-making around the current time vs a target time are what prompted me to create Also, I have to say Birl has provided a great resource to the community being the first time package by far, and the name is fantastic! |
Thanks for the kind words @jrstrunk |
I totally understand, maintaining open-source packages is a lot of hard work for little gain. I hope you do regain motivation at some point, we all learn from each other and are better together! Since Birl has seen a lot of adoption, I might encourage you to find another member of the community to give co-access to this repo and hex package in case dependencies need to be updated or something and you are away. Louis is an easy pick, but you might know someone else you'd like to onboard. Completely up to you, just thinking long term! Anyway thanks again for your contributions, I'll close this issue now. Cheers! |
Hey everyone, just wanted to start a discussion. Since Gleam has a really nice type system and as a language heavily encourages you to use types to reduce the possibility of bugs or crashes, I thought it would really help reduce time related bugs if Time and NaiveTime were different types. I know a big downside is that it would add a lot more code to this package and probably bump birl up a major version, but it will really make sure that when people do comparisons and conversions between times, they know how time offsets will be handled. For example, if I wanted to compare two time values, say
2019-01-02T14:00:00.000
and2019-01-02T14:00:00.000-04:00
, it is not obvious to me how the compare function will behave in this case. Maybe only the naive times are compared, maybe they are both converted to UTC and compared, I cannot know until I run some tests. If instead I was forced to convert them both to the same time type myself, then I could be sure how they are being compared: I could give the first an offset and compare it to the second with thecompare
function. Or I could make the second naive by callingto_naive
(and rename the current func toto_naive_string
) and compare them with acompare_naive
function. This gives me, the application implementer, explicit control over how I deal with time offsets and zones, instead of assuming the birl package will handle them the way I want every time.The text was updated successfully, but these errors were encountered: