Our pure JavaScript Scheduler component


Post by sgodbout »

When we set our DateHelper locale to french (fr), we are experiencing an issue with making changes to the date fields in the TaskEdit modal.

They properly display in the french format (DD/MM/YYYY). If we try to update the date using the left/right arrows, there's no problem.

However, if we try to adjust the dates by typing, then hit save button, it seems to interpret it as an english date (MM/DD/YYYY), reversing month and day before saving, and therefore causes bugs.

As a solution, we tried changing the date format in the locale parsers field, to just always display it in english format instead, but it doesn't take the config and just always displays it in french format.
Any ideas how to fix this?

Attachments
Screen Shot 2022-08-07 at 10.38.15 AM.png
Screen Shot 2022-08-07 at 10.38.15 AM.png (114.78 KiB) Viewed 170 times
Screen Shot 2022-08-07 at 10.33.09 AM.png
Screen Shot 2022-08-07 at 10.33.09 AM.png (54.95 KiB) Viewed 171 times

Post by alex.l »

Hi sgodbout,

Do you see this problem here https://bryntum.com/examples/gantt/localization/ ?
If not, please share your locale configs, how did you apply it, and date field configs and listeners, if any.

All the best,
Alex


Post by sgodbout »

Hey,
It does seem to be working properly in that Gantt demo, as far as I can tell.

I've attached the french locale file.
I know it's being properly used, since if I set DateHelper.locale = 'en' in the file, the dates revert to english as anticipated.

However, when DateHelper.locale = 'fr' or 'fr-Ca', changes to the the DateHelper.parsers object has no impact and default is always shown (as above post), which then seems to cause the saving bug.
(default for fr -> DD/MM/YYYY, for fr-Ca -> YYYY-MM-DD).

Attachments
Fr.js
(7.19 KiB) Downloaded 6 times

Post by sgodbout »

Maybe the reasons parsers in the locale doesn't work is because TaskEdit startDateField is not a date nor a time field, but a DateTimeField?
It doesn't look like there's a format property to adjust that would fix the issue.

https://www.bryntum.com/docs/scheduler-pro/api/Core/widget/DateTimeField


Post by alex.l »

DateTimeField has properties to configure dateField and timeField separately.
Please see
https://www.bryntum.com/docs/scheduler-pro/api/Core/widget/DateTimeField#config-dateField
https://www.bryntum.com/docs/scheduler-pro/api/Core/widget/DateTimeField#config-timeField

Configuration should be the same as you apply to dateField/timeField.
Regarding to locale, it should work for this field as well. DateTimeField just a container with some extra API, that uses two fields inside with full functionality.

All the best,
Alex


Post by sgodbout »

Alright, that worked!
By adjusting the formats of the date and time fields separately,
I was finally able to get acceptable behaviour.
Tx for pointing in the right direction. : )


Post Reply