At product edit page, I’m trying to add image hide date “a custom field of datepicker” so far it shows the inputbox but not calender upon clicking the box. I have override gallery.phtml and added custom input, but the script code for calender is not working.
Here’s the code:
<div class="admin__field field-display-image">
<div class="admin__field-control">
<div class="admin__field admin__field-option">
<label for="display-image-from-product-page-<%- data.file_id %>" class="admin__field-label vashi">
<?= /* @escapeNotVerified */ __('Image Time Scope') ?>
</label>
<input type="text" class="input-text" id="example-date" style="width: auto" name="example-date" />
</div>
</div>
</div>
and script
<script>
require([
'jquery',
'mage/translate',
'mage/calendar'
], function ($, $t) {
$('#example-date').calendar({
alert('hi');
changeMonth: true,
changeYear: true,
showButtonPanel: true,
currentText: $t('Go Today'),
closeText: $t('Close'),
showWeek: true
});
})
</script>
All these in gallery.phtml