-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Dates defines nonsensical conversions #19896
Comments
Or to define such conversions only in one direction (probably the one from unitful to unitless?). |
@nalimilan, I don't think they can be defined at all. Consider: julia> d = convert(Dates.Day, 1)
1 day
julia> d == 1
false Saying that you can |
Attaching units and removing specific units are reasonable operations, but just removing any units from a quantity is usually dangerous and should not be easily available. "I know the computation lasted for 6.2, but I don't care whether it were seconds or hours."---That doesn't seem right. And I also agree that attaching units should not be a |
I've posted this kind of thing elsewhere about other unitful quantities, but just noticed that we have the same problem with dates. Succinct example:
Seems OK, right? But consider:
You can get two wildly different answers when you convert days to seconds this way. The only sensible approach is not to define conversions between unitless and unitful objects.
The text was updated successfully, but these errors were encountered: