No Code Attached Yet bug
avatar Fedik
Fedik
25 Aug 2023

Calendar field does not work with non numeric non english date formats.

The field does not able to recognise a date that contain textual format (like months, days names) for non english language.
In best it will store an empty value, in worst it will store a random value.

This affect all Joomla version from 3 to 5.

To fix the issue should be done following:

  • The value should be transfer betwen client/server in SQL format, always.
  • The format attribute should be used only for display, or even better it should be dropped all together, and use Browser INTL to display local date-time.
  • The field input should be read only, date/time input possible only throught date-time picker. No free input.
  • As result, the attribute like filterformat, and lang constant DATE_FORMAT_FILTER_.. should be dropped.

This also will fix issue related to deprected strftime().

Current workaround:
Always use only numeric date-time formats.

References:

avatar Fedik Fedik - open - 25 Aug 2023
avatar joomla-cms-bot joomla-cms-bot - change - 25 Aug 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Aug 2023
avatar Fedik Fedik - change - 25 Aug 2023
Labels Added: bug
avatar Fedik Fedik - labeled - 25 Aug 2023
avatar dgrammatiko
dgrammatiko - comment - 25 Aug 2023

The value should be transfer betwen client/server in SQL format, always.

Agree 10000%

The format attribute should be used only for display, or even better it should be dropped all together, and use Browser INTL to display local date-time.

Agree, for those not knowing what Intl is, read this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat

The field input should be read only, date/time input possible only throught date-time picker. No free input.

This brings back memories, bad ones...

As result, the attribute like filterformat, and lang constant DATE_FORMAT_FILTER_.. should be dropped.

Yup.

Just to add that TC39 has already approved, stage 3 Temporal the replacement of the Date class but waiting another standards body to agree on the timezones (or something similar).

Temporal has ALL the known Calendars!!!
Temporal has a polyfill that could be used right now (it's just JS)
Temporal probably will be introduced on a later PHP

Basically, what I'm trying to say here is that the calendar could be way better with less code written here if someone puts the effort to do a GUI leveraging the Temporal polyfill (with some clever check, so the polyfill could be skipped for Browsers supporting it, some time in the future).

Add a Comment

Login with GitHub to post a comment