ember-changeset-validations icon indicating copy to clipboard operation
ember-changeset-validations copied to clipboard

[Proposal] Use isEmpty for the date validator's allowBlank alike the other validators

Open frykten opened this issue 4 years ago • 0 comments

Heya!

I tried to follow the discussion from which birthed the current date validator, but I couldn't find an answer: why do you not allow empty strings '' in this validator? The other validators from this addon do so; ember-validators, from where this addon takes a lot, do so (cf.).

Was there a reason? Maybe it's due to moment.js?

I see you added that in the tests as invalid cases; meanwhile all the other validators have the empty string as, at minima, the only "blank" value. Shouldn't we here base the "blank" check on either the isEmpty() or isBlank() Ember's utils' methods (just as ember-validators, which is used for this addon's number validator)?

To have the same behaviour for such options on all validators would ease the use of the API, I think.

frykten avatar Oct 14 '21 13:10 frykten