Created
July 23, 2020 13:34
-
-
Save hamzamu/0b7b52e637ee5ce4104ef2c8239d5a2f to your computer and use it in GitHub Desktop.
Bulma Clanedar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var options = { | |
type: data.type || 'date', | |
minDate: new Date(), | |
// displayMode:'dialog', | |
showHeader: false, | |
// maxDate: '2018-12-31', | |
// dateFormat: 'yyyy-mm-dd', | |
isRange: false, | |
// showTodayButton: true, | |
// enableYearSwitch: true | |
} | |
if(data.date == 'future'){ | |
startDate: new Date() | |
options.minDate = new Date() | |
} | |
if(data.date == 'past'){ | |
options.maxDate = new Date() | |
} | |
var calendars = bulmaCalendar.attach('[type="date"]', options); | |
// Loop on each calendar initialized | |
for (var i = 0; i < calendars.length; i++) { | |
// Add listener to date:selected event | |
calendars[i].on('select', date => { | |
console.log('Date Selected: ', date, date.timeStamp, moment(date.timeStamp).toDate()); | |
App.setSetting({ | |
selectedDate: moment(date.timeStamp).toDate() | |
}) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment