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

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

Đang mở
#317 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
215
Fork
98
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.