You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the material datetime picker to save dates in DD-MM-YYY format. It works fine, but I can't get the picker to open with another default date as the the current date.
My attempt:
import MaterialDatePicker from "material-datetime-picker";
import moment from "moment";
const input = $el
const picker = new MaterialDatePicker(
{
default: moment(),
format: 'DD-MM-YYYY',
value: (input.value !== '' ? input.value : moment()) //attempt 1 to set input value as picker value
})
.on('submit', (val) => {
input.value = val.format("DD-MM-YYYY")
});
input.addEventListener('focus', () => {
picker.open()
//attempt 2 to set input value as picker value
picker.value = input.value
})
input.value is a date string in MM-DD-YYY format, which i'd like to open as the default picker value. Is this possible and if so; how does one achieve this?
Best regards,
Peter
The text was updated successfully, but these errors were encountered:
Hi there,
I am using the material datetime picker to save dates in DD-MM-YYY format. It works fine, but I can't get the picker to open with another default date as the the current date.
My attempt:
input.value is a date string in MM-DD-YYY format, which i'd like to open as the default picker value. Is this possible and if so; how does one achieve this?
Best regards,
Peter
The text was updated successfully, but these errors were encountered: