mdehoog / Semantic-UI-Calendar

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

Date and time formatting? #107

Open jjnxpct opened 6 years ago

jjnxpct commented 6 years ago

Is there a way to format the date in the 'day' view where the hours are shown? And also, can we change the formatting of the time to 24 hours? Without the AM/PM?

balexandre commented 6 years ago

Without the AM/PM?

{
    ...,
    ampm: false
}
jjnxpct commented 6 years ago

2017-11-08_15-41-51

I would like to format the date above the 'hours' view (in this example to '16 november 2017' and also the hours to a 24 hour format. In the 24 hour format we do not use AM/PM.

I do have to mention we use this datepicker as a part of Chronoforms. This is a Joomla CMS form extension that uses semantic-ui-calendar to create a datepicker field. I am not sure how / wehre this datepicker is initialised, but mabe I could use some javascript to override the settings somehow?

jjnxpct commented 6 years ago

We have the option to add dat attributes to the datepikcer field. We use these: data-days:Z, M, D, W, D, V, Z data-monthsShort:Jan, Feb, Mar, Apr, Mei, Jun, Jul, Aug, Sep, Okt, Nov, Dec data-months:Januari, Februari, Maart, April, Mei, Juni, Juli, Augustus, September, Oktober, November, December

But adding 'data-ampm:false' to this does not work ;-)

Can the option ampm be add by data attributes?

balexandre commented 6 years ago

This is what I have:

using simply:

    .calendar({
        type: 'datetime',
        ampm: false,
        monthFirst: false
    });
jjnxpct commented 6 years ago

Thanks balexandre. The thing is, we use Chronoforms 6 to create our form. So I guess I need to ask the creator of this extension for Joomla to let us somehow include these settings in the form field or tell us how to 'override' the default settings using script at the top of the form or something.

For now I have make changes to the calendar.min.js file to change the defaults for these values. This works for now, but I would prefer to be able to set these parameters in the form extension.

Anyway, thanks for pointing me to the right parameters.

Just to be sure: These settings (ampm and monthFirst) can not be set by data attributes on the date field?

balexandre commented 6 years ago

Just to be sure: These settings (ampm and monthFirst) can not be set by data attributes on the date field?

I don't see anything in code to support that...

jjnxpct commented 6 years ago

OK, thanks balexandre!