Mel0nc0lly
Mel0nc0lly

Reputation: 158

Format date header without the month number FullCalendar

In FullCalendar resource timeline, I am trying to change the date display from ddd mm/d to ddd d

The title already tells the user the month, so to make it easier to read for UK folks I want to move away from US date formats.

I tried

locale: 'gb', 

but couldn't get any joy. I have searched but drawing a bit of a blank.

Here's what i have:

FullCalendar image

and here's what I want:

another FullCalendar image

It's probably simple!

Upvotes: 0

Views: 211

Answers (1)

Mel0nc0lly
Mel0nc0lly

Reputation: 158

OK, so thanks to @Adyson (again). I had looked at the locales page but failed to notice the JS file that i needed to include.

Thanks to @RobG for reminding me of the correct locale for UK.

Both of these together helped switch MM/DD to DD/MM. Thanks!

Thanks to @Aziz sonawalla - your suggestion didn't get me there because I'm using a newer version.

The key to it was to find (stumble across) the correct item to configure, in this case it was

slotLabelFormat

So, I used this and it got me just about there:

slotLabelFormat:[ { weekday: 'short', day: 'numeric', omitCommas: true },{hour: 'numeric'}],

I am using two headers, because i can and it's really nice:

slotLabelInterval: [{days: 1},{hours:12}],

And this all gets me a top header with 'ddd d' as desired, and a bottom header of '00' or '12'

I would be the happiest person in Donegal if i could change the bottom header to 'AM' and 'PM'. I have tried various changes to the

hour: 'numeric'

setting but it is beyond my skills to find the right tweak to make. I also tried

meridiem: 'A'

but that displayed a date only.

Thanks for all the help thus far!

Upvotes: 1

Related Questions