To be straightforward, here's the code of my picker:
import {moment} from 'moment';
const datePicker = () => {
$('.datetimepicker').datetimepicker({
format: 'LT',
locale: 'PT-BR',
icons: {
up: "fa fa-chevron-up",
down: "fa fa-chevron-down",
},
stepping: 15,
disabledTimeIntervals: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
});
};
export {datePicker};
The line disabledTimeIntervals: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
is coming direct from the documentation .
But adding it causes dtPicker.js:24 Uncaught TypeError: Object(...) is not a function
you are importing moment the wrong way
import moment from "moment"; // correct way
this answer is after 10 months but may help others
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.