adopted-ember-addons / adopted-ember-addons/ember-changeset-validations

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

Abierto
#317 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
215
Forks
98
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.](https://github.com/offirgolan/ember-validators/blob/1568f472eb5d9851222b9944521ff1ba529641dd/addon/date.js#L29)).

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.