Our powerful JS Calendar component


Post by licjapodaca »

Hi there, I would like to interact with the time range column in AgendaView to include the end date correctly for all those events marked as "allDay" in true, but I need to change the time format of the time range in 12h format including the am/pm like so:

agendaview-calendar.png
agendaview-calendar.png (297.24 KiB) Viewed 658 times

How to do that?

Regards


Post by alex.l »

Time format depends on localization and managed by locale property of DateHelper.
Same for all day event and "Ends " text
Localization file example


Calendar : {
    Today      : 'Today',
    next       : range => `Next ${range}`,
    previous   : range => `Previous ${range}`,
    plusMore   : value => `+${value} more`,
    allDay     : 'All day', // < --- all day text
    endsOn     : d => `Ends ${d}`, // <--- ends on text format , you can remove text and leave a placeholder only

DateHelper : {
    locale         : 'de', // <<--- this setting is manage date formats. as example for `en` it will be formatted in am/pm 

See https://bryntum.com/examples/calendar/localization/ , try to change language to check.

All the rest is not configurable at the moment. Please let us know if it's enough to reach your goals and if not, please provide an idea how do you expect it should working.

All the best,
Alex


Post by licjapodaca »

Hi @alex, I already change the "endsOn" locale key like you told me:

...
"AgendaView": {
	"Agenda": "Agenda",
	"Day": "Día",
	"Month": "Mes",
	"Year": "Año",
	"endsOn": d => `Vence el ${d}`, // <==== It works ... thanks
	allDay: "Todo el día"
},
...

Now, if I change the main language to 'en' the time range in AgendaView appears correctly to "am/pm" ... but the month and day names changed to ENGLISH, I don't want to use ENGLISH, instead I have created a new locale language that is SPANISH, I just want to change the time range part of the AgendaView like so:

calendar-changes.png
calendar-changes.png (281.69 KiB) Viewed 635 times

Regards


Post by Animal »

It uses a mode config called eventTimeFormat to generate that. It's 'HH:mm' by default, but you could change that in the mode config, or if you want to change it for all modes in the modeDefaults config.

It's not documented, sorry about that. All these little configurable tweaks were built in fro the start, but while building them, documenting them fell by the wayside a bit!


Post by Animal »

Actually, that seems redundant. There is already a timeFormat, so I should rename eventTimeFormat to agendaTimeFormat in the next version.

Be prepared if you choose to use the undocumented name!


Post by licjapodaca »

Thanks @animal, I will prepare with that change in the next version ...

It works by now...

Regards


Post by Animal »

Keep an eye o release notes for this ticket: https://github.com/bryntum/support/issues/4375


Post by Animal »

Here's what I have in the fix branch. This will be in the next point release, 5.1, not the next patch release. ListView and AgendaView have had brain surgery and the main branch, so the fix had to go here.

Screenshot 2022-03-16 at 09.35.13.png
Screenshot 2022-03-16 at 09.35.13.png (59.66 KiB) Viewed 618 times

Post Reply