mybuddy/babybuddy/static_src/js/babybuddy.js

38 lines
976 B
JavaScript
Raw Normal View History

2017-10-22 18:00:42 +00:00
if (typeof jQuery === 'undefined') {
throw new Error('Baby Buddy requires jQuery.')
}
2020-01-27 22:56:37 +00:00
if (typeof moment === 'undefined') {
throw new Error('Baby Buddy requires moment.js.')
}
2017-10-22 18:00:42 +00:00
2020-01-27 22:56:37 +00:00
/**
* Baby Buddy Namespace
*
* Default namespace for the Baby Buddy app.
*/
2017-10-22 18:00:42 +00:00
var BabyBuddy = function () {
2020-01-27 22:56:37 +00:00
return {};
2017-10-22 18:00:42 +00:00
}();
2020-01-27 22:56:37 +00:00
/**
* Baby Buddy Datetime Picker
*
* Provides modifications and defaults for the base datetime picker widget.
*/
BabyBuddy.DatetimePicker = function ($, moment) {
return {
init: function (element, options) {
var defaultOptions = {
allowInputToggle: true,
buttons: { showToday: true, showClose: true },
2020-01-27 22:56:37 +00:00
defaultDate: 'now',
format: 'L LT',
ignoreReadonly: true,
locale: moment.locale(),
useCurrent: false
};
element.datetimepicker($.extend(defaultOptions, options));
}
};
}(jQuery, moment);