scinote-web/app/assets/javascripts/sitewide/date_time_picker.js
ajugo 8ff822c7e5
Implement due date column in experiment table view [SCI-7406] (#4646)
* Implement due date column in experiment table view [SCI-7406]

* Fix due date [SCI-7406]

* Move text to translation [SCI-7406]

* Fix table due date partial [SCI-7406]

* Fix table due date partial [SCI-7406]
2022-12-02 11:01:40 +01:00

24 lines
640 B
JavaScript

(function() {
'use strict';
$(document).on('click', '[data-toggle="date-time-picker"]', function(ev) {
ev.preventDefault();
ev.stopPropagation();
let dt = $(this);
if (dt.data('DateTimePicker')) {
dt.data('DateTimePicker').destroy();
}
dt.datetimepicker({ ignoreReadonly: true });
dt.data('DateTimePicker').show();
});
$(document).on('mousedown', '[data-toggle="clear-date-time-picker"]', function() {
let dt = $(`#${$(this).data('target')}`);
if (!dt.data('DateTimePicker')) dt.datetimepicker({ useCurrent: false });
dt.data('DateTimePicker').clear();
dt.val('');
});
}());