Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
<items jcr:primaryType="nt:unstructured">
<default
jcr:primaryType="nt:unstructured"
wrapperClass="cmp-adaptiveform-datepicker__defaultdate"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldDescription="Please enter the date in the required format &quot;yyyy-mm-dd&quot;."
fieldLabel="Default date"
emptyText="YYYY-MM-DD"
name="./default"/>
</items>
</column>
Expand Down Expand Up @@ -80,9 +80,9 @@
<minimum
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/datepicker"
wrapperClass="cmp-adaptiveform-datepicker__mindate"
fieldDescription="Please enter the date in the required format &quot;yyyy-mm-dd&quot;."
fieldLabel="Minimum date"
emptyText="YYYY-MM-DD"
name="./minimumDate"
valueFormat="YYYY-MM-DD[T]HH:mm:ss.000-00:00"/> <!-- Enforce UTC timezone to be timezone agnostic -->
<minimumMessage
Expand All @@ -108,9 +108,9 @@
<maximum
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/datepicker"
wrapperClass="cmp-adaptiveform-datepicker__maxdate"
fieldDescription="Please enter the date in the required format &quot;yyyy-mm-dd&quot;."
fieldLabel="Maximum date"
emptyText="YYYY-MM-DD"
name="./maximumDate"
valueFormat="YYYY-MM-DD[T]HH:mm:ss.000-00:00"/> <!-- Enforce UTC timezone to be timezone agnostic -->
<maximumMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
DATEPICKER_EDITFORMAT = EDIT_DIALOG + " .cmp-adaptiveform-datepicker__editformat",
DATEPICKER_LANG = EDIT_DIALOG + " .cmp-adaptiveform-datepicker__lang",
DATEPICKER_LANGDISPLAYVALUE = EDIT_DIALOG + " .cmp-adaptiveform-datepicker__langdisplayvalue",
DATEPICKER_DEFAULTDATE = EDIT_DIALOG + " .cmp-adaptiveform-datepicker__defaultdate",
DATEPICKER_MINDATE = EDIT_DIALOG + " .cmp-adaptiveform-datepicker__mindate",
DATEPICKER_MAXDATE = EDIT_DIALOG + " .cmp-adaptiveform-datepicker__maxdate",
Utils = window.CQ.FormsCoreComponents.Utils.v1;


Expand All @@ -47,5 +50,24 @@
Utils.handlePatternFormat(dialog,DATEPICKER_LANGDISPLAYVALUE,DATEPICKER_LANG);
}

Utils.initializeEditDialog(EDIT_DIALOG)(handleDisplayPatternDropDown,handleDisplayFormat,handleEditPatternDropDown,handleEditFormat,handleLang);
function handleDatePlaceholders(dialog){
var defaultDateInput = dialog.find(DATEPICKER_DEFAULTDATE + " input")[0],
minDateInput = dialog.find(DATEPICKER_MINDATE + " coral-datepicker")[0],
maxDateInput = dialog.find(DATEPICKER_MAXDATE + " coral-datepicker")[0],
defaultDateTooltip = dialog.find(DATEPICKER_DEFAULTDATE + " coral-tooltip")[0],
minDateTooltip = dialog.find(DATEPICKER_MINDATE + " coral-tooltip")[0],
maxDateTooltip = dialog.find(DATEPICKER_MAXDATE + " coral-tooltip")[0],
emptyText = Granite.I18n.get('YYYY-MM-DD', null, 'placeholder text to retain format across locale'),
fieldDescription = Granite.I18n.get('Please enter the date in the required format "yyyy-mm-dd".', null, 'placeholder text to retain format across locale');

defaultDateInput.placeholder = emptyText;
defaultDateInput.setAttribute('aria-label', emptyText);
minDateInput.placeholder = emptyText;
maxDateInput.placeholder = emptyText;
defaultDateTooltip.innerHTML = fieldDescription;
minDateTooltip.innerHTML = fieldDescription;
maxDateTooltip.innerHTML = fieldDescription;
}

Utils.initializeEditDialog(EDIT_DIALOG)(handleDisplayPatternDropDown,handleDisplayFormat,handleEditPatternDropDown,handleEditFormat,handleLang,handleDatePlaceholders);
})(jQuery);