Semantic-UI-Calendar icon indicating copy to clipboard operation
Semantic-UI-Calendar copied to clipboard

Date and time formatting?

Open jjnxpct opened this issue 7 years ago • 7 comments

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?

jjnxpct avatar Oct 31 '17 17:10 jjnxpct

Without the AM/PM?

{
    ...,
    ampm: false
}

balexandre avatar Nov 08 '17 14:11 balexandre

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 avatar Nov 08 '17 14:11 jjnxpct

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?

jjnxpct avatar Nov 08 '17 15:11 jjnxpct

This is what I have:

using simply:

    .calendar({
        type: 'datetime',
        ampm: false,
        monthFirst: false
    });

balexandre avatar Nov 08 '17 17:11 balexandre

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?

jjnxpct avatar Nov 09 '17 11:11 jjnxpct

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...

balexandre avatar Nov 09 '17 20:11 balexandre

OK, thanks balexandre!

jjnxpct avatar Nov 10 '17 08:11 jjnxpct