Rely purely on moment to determine input validity#93
Rely purely on moment to determine input validity#93brockpetrie wants to merge 1 commit intomasterfrom
Conversation
|
The code changes make sense, the only thing is that this contradicts the changes we made for #29 |
|
That is a pretty big contradiction, isn't it... How do you feel about it? I think I've come full circle: respect how Moment handles inputs, and either proceed or abort depending on Moment's thumbs up. |
BrockReece
left a comment
There was a problem hiding this comment.
I have no strong feelings either way to be honest, though a lot of feedback we had in the issues was around not firing the console warning rather than displaying nothing if the input is falsey.
|
@brockpetrie - I've been testing this branch with our system and it works well. I agree with your assessment that For instance, this snippet of markup: Helps to produce the following: Everywhere there are dashes in the UI is where there was It also means that it's important to have no output if the input is There are situations where we end up rendering a lot of data that has had few or no events yet - ex: That brings me to the only suggestion I have for this PR. In #81 at the top of the function I had a null guard (it also guarded Either way, we'd very much like to have this be the default behavior, so you get my 👍 for merging 😄 |
|
Though I was just re-reading your comments from 3 days ago about my PR #81 going too far by guarding the invalid inputs... so yeah - either way, letting moment do the processing means you'll get whatever it does at a small performance penalty for "invalid" inputs (null, empty string). Guarding those values at the top will give you a performance bump, but I'm not clear on how much and it's possible our status pages that contain a lot of as-yet pending events are unusual. I'm also happy to close #81, but it looks like when you merge this it will automatically close, so leaving it for now. Thanks! |
|
Have you thought about merging this at all? We are still using our modified fork. Someday I'd like to switch back to your npm package instead. Thanks! |
|
Leaving this PR hanging like this is torture. So close, yet so far.. |
|
Any updates about this PR? |
BrockReece
left a comment
There was a problem hiding this comment.
I think we should just bite the bullet and go with this.
|
@brockpetrie Are you happy for me to merge this in and release? |
|
Yes! One of the Brocks please merge this 😁 (coming up on one year since I did the first pull request for this). |


Removes our falsey check on
inputon line 38. This allows forundefinedinputs, which are considered valid by moment and treated the same as callingnew Date().This also removes the console warning in that same if block.
Fixes #75, closes #81 and closes #91. Breaking change! Any thoughts on this, @BrockReece?
Thanks to @bitencode for doing the initial legwork.