You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have instances where I need to validate other formats, mm/dd/yyyy or dd/mm/yyyy for example.
Those formats never seem to validate with this gem.
I added the following context to spec/validates_timeliness/validator/format_spec.rb under the date type, and it fails the specs on the gem.
context "when the format is dd/mm/yyyy" do
before do
Person.validates_date :birth_date, format: "dd/mm/yyyy"
end
it "should be valid for string given in the right format" do
valid!(:birth_date, '23/12/2023')
end
it "should not be valid for string given in the wrong format" do
invalid!(:birth_date, '2023-12-23', /is not a valid date/)
end
it "should be valid for date instance" do
valid!(:birth_date, Date.new(2022,12,23))
end
end
Failure/Error: expect(record).to be_valid
expected `#<Person:0x0000000109337f20 @attributes=#<ActiveModel::AttributeSet:0x0000000109337ea8 @attributes={"...Model::Error attribute=birth_date, type=invalid_date, options={:message=>nil, :restriction=>nil}>]>>.valid?` to be truthy, got false
The text was updated successfully, but these errors were encountered:
I have instances where I need to validate other formats,
mm/dd/yyyy
ordd/mm/yyyy
for example.Those formats never seem to validate with this gem.
I added the following context to
spec/validates_timeliness/validator/format_spec.rb
under the date type, and it fails the specs on the gem.The text was updated successfully, but these errors were encountered: