mdehoog / Semantic-UI-Calendar

Calendar module for Semantic UI
MIT License
805 stars 127 forks source link

Changing the datetime #112

Open TELLO0815 opened 6 years ago

TELLO0815 commented 6 years ago

How can i change to format yyyy-MM-ddThh:mm?

`ampm: false,
        monthFirst: false,
        formatter: {
            date: function (date, settings) {
                if (!date) return '';
                var day = date.getDate();
                var month = date.getMonth() + 1;
                var year = date.getFullYear();
                var hour = date.getHours();
                var minu = date.getMinutes();
                return year + '-' + month + '-' + day + 'T' + hour + ':' + minu;
            }
        },
        type: 'datetime',`

Output: 2017-12-19T13:15 13:15

So on the end is the time again...

dbendaou commented 6 years ago

Have the same issue here ! Seems the date is setting once the day is selected, and then resetting once hour is selected. It result displaying the hours two times ...

dbendaou commented 6 years ago

Okkkkkkk, it's because you should use datetime instead of date in the formatter

So it should look to something like


        monthFirst: false,
        formatter: {
            datetime: function (date, settings) {
         etc....
dbendaou commented 6 years ago

should be close then