-
Notifications
You must be signed in to change notification settings - Fork 14
Should clamping be the default behavior for a new Time object? #18
Comments
@oldfartdeveloper what you are proposing sounds like a good solution, +1 for that |
I disagree with this change. I don't want to have to deal with |
Also worth pointing out is that if you do need validation you can always use the provided |
@ericgj @Bogdamp For those who want simplicity, I offered the new API function, |
If you insist on providing Why don't you try it out first and see if you like dealing with all date operations within a |
After thinking about it and talking it over with some other Elm developers, I came to the following realizations:
Hence, I'm not going to attempt to rename Closing this issue. |
Referencing the README:
Constructing Dates
Use
date
to constructDate
values. If given invalid values forthe month and day, they are both clamped and the nearest valid date is
returned.
This is wrong on the basis of the
#create
function is doing two things:This would be tolerable if there was any other way to create the object, but unfortunately there isn't. Hence, in my mind the
#create
function is broken, and if I want to use this module, I have to write a wrapper around this class. I will probably instead fork the module, modify it, and then publish it as a "better" competitor. As the maintainer, I say #ughHere's my suggested solution that still allows clamping:
#create_clamped
, that will do exactly that, AND the name of the function explains what it is doing.Everybody wins.
The text was updated successfully, but these errors were encountered: