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
Setter functions should handle garbage input better #3483
Comments
Silent fail. Probably be quite doable as up-for-grabs. |
Hi @mj1856 @maggiepint ! |
@mbad0la probably. Basically, we need to validate that the input to a set function is of type number before we actually run the set on the date that is contained internally. |
@maggiepint let me try this then? I'll let you know of my progress. |
Hi Hi - I was looking into this and was wondering what the status was. It looks like CI failed for last attempt by @mbad0la. Would anyone mind if I took a stab at it? I dont want to step on anyone's toes ^^ |
Hi @willdembinski I'm almost done with the PR. Did you follow the conversation on the PR thread? |
I did read the PR thread. Hence the question 😝 🐛 |
Maggie! Youre so sweet :) Thanks for doing that. Ill take a look when Im out of |
I had a quick question. "Overflowing" in the context of moment.js: Is that when one adds a unit of time to some component of time (1 hour,1 OR is it when moment("2011-01-40") => Feb 10 2011? Do you have a word for |
@willdembinski - typically when we talk about overflow/underflow, we mean the latter. Your first example is just a one minute addition. |
Though also note that it would be Feb 9th, and we don't actually allow for overflow in the constructor like that in moment. It would just be an invalid date. |
@maggiepint @mj1856 @mbad0la - I wanted to swing back around on this and (with utmost respect to whomever may have already put forth effort) ask if it is ok to take a poke at it (or if its still a valid opportunity). :) |
@willdembinski go for it. You can start from #3486 and revise as needed, or rewrite. But do look at the feedback on there. |
@maggiepint - When you have the time, please check out #3704. I feel like it could be better? JS and its coercion shenanigans never fail to amaze me. |
Closed in favor of #3704 |
As discussed in #3436, the setter functions like
year
don't handle garbage input well.Same goes for many of the other setters, such as
date
andhour
. They should all be checked.Since many other functions, including
add
will fail silently on garbage input, these probably should also. The alternative would be to throw an error, which would be inconsistent with the rest of the library.The text was updated successfully, but these errors were encountered: