mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-02 02:11:33 +00:00
introduce "Now" button
Throught the plugin: https://github.com/jcsmorais/shortcut-buttons-flatpickr import js library via yarn
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
angular.module("admin.utils").directive "datepicker", ->
|
||||
angular.module("admin.utils").directive "datepicker", ($window, $timeout) ->
|
||||
require: "ngModel"
|
||||
link: (scope, element, attrs, ngModel) ->
|
||||
flatpickr(element, Object.assign({},
|
||||
window.FLATPICKR_DATE_DEFAULT, {
|
||||
onOpen: (selectedDates, dateStr, instance) ->
|
||||
instance.setDate(ngModel.$modelValue)
|
||||
}));
|
||||
$timeout ->
|
||||
flatpickr(element, Object.assign(
|
||||
{},
|
||||
$window.FLATPICKR_DATE_DEFAULT, {
|
||||
onOpen: (selectedDates, dateStr, instance) ->
|
||||
instance.setDate(ngModel.$modelValue)
|
||||
}
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user