Skip to content

Commit 26fcc0a

Browse files
authored
ENGCOM-5118: Fixed Validation messages missing from datepicker form elements #21397
2 parents dc583c9 + 8ff34b7 commit 26fcc0a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@
285285
<settings>
286286
<validation>
287287
<rule name="validate-date" xsi:type="boolean">true</rule>
288+
<rule name="validate-date-range" xsi:type="string">custom_theme_from</rule>
288289
</validation>
289290
<dataType>text</dataType>
290291
<label translate="true">To</label>

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,14 @@ define([
803803
},
804804
$.mage.__('Please enter a valid date.')
805805
],
806+
'validate-date-range': [
807+
function (value, params) {
808+
var fromDate = $('input[name*="' + params + '"]').val();
809+
810+
return moment.utc(value).unix() >= moment.utc(fromDate).unix() || isNaN(moment.utc(value).unix());
811+
},
812+
$.mage.__('Make sure the To Date is later than or the same as the From Date.')
813+
],
806814
'validate-identifier': [
807815
function (value) {
808816
return utils.isEmptyNoTrim(value) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(value);

0 commit comments

Comments
 (0)