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
importJustValidatePluginDatefrom"just-validate-plugin-date";validation.addField("input[type=date][name=start_date]",[{plugin: JustValidatePluginDate(()=>({format: "yyyy-mm-dd",isBefore: "2022-06-08",// or new Date(2022, 5, 8)isAfter: "2022-06-02"// or new Date(2022, 5, 2)})),errorMessage: "Date should be between 2022-06-02 and 2022-06-08",},]);
Validation fails when input[type="date"][name="start_date"] value is 2022-06-08. Likewise, when the input value is set to 2022-06-02 validation fails. Both exclude itself when compared to the input value.
Expectation π
When the input value is equal to isBefore or isAfter should validate with no fails.
Temporary Solution π€π»
Add one day to isBefore and subtract one day to isAfter.
importJustValidatePluginDatefrom"just-validate-plugin-date";constisBefore=newDate(2022,5,8);isBefore.setDate(isBefore.getDate()+1);constisAfter=newDate(2022,5,2);isAfter.setDate(isAfter.getDate()-1);validation.addField("input[type=date][name=start_date]",[{plugin: JustValidatePluginDate(()=>({format: "yyyy-mm-dd",
isBefore,
isAfter
})),errorMessage: "Date should be between 2022-06-02 and 2022-06-08",},]);
The text was updated successfully, but these errors were encountered:
I decided to keep the isAfter and isBefore as it is, but I added the new validators: isBeforeOrEqual, isAfterOrEqual and just in case if needed to compare just for the same day: isEqual
Problem π΅βπ«
Validation fails when
input[type="date"][name="start_date"]
value is2022-06-08
. Likewise, when the input value is set to2022-06-02
validation fails. Both exclude itself when compared to the input value.Expectation π
When the input value is equal to
isBefore
orisAfter
should validate with no fails.Temporary Solution π€π»
Add one day to
isBefore
and subtract one day toisAfter
.The text was updated successfully, but these errors were encountered: