Skip to content

[5.3] FIX mistyped dates #45758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

Conversation

tkuschel
Copy link
Contributor

@tkuschel tkuschel commented Jul 20, 2025

Pull Request for Issue #45369 .

Summary of Changes

  1. In javascript, if the year size is entered greater than 9999, the current year is used.
  2. When entered a two-digit year number (already implemented): if the year is greater than 39, then 1900 is used for the decade, otherwise 2000. (November 2016 it was the year 29). Now use a constant TWODIGITYEAR.
  3. In the CalendarField, if the format() when using filterFormat fails, a meaningful error message is generated (Hardening).

Testing Instructions

Create/edit article, mistype date in any of the date fields (not using the date picker) on the Publishing tab.
Proper date: 2025-04-23 12:01:40
Mistyped date: 20225-04-23 12:01:40

Actual result BEFORE applying this Pull Request

Throws error:
Call to a member function format() on false

Expected result AFTER applying this Pull Request (and npm ci)

The current year is used.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.3-dev labels Jul 20, 2025
@brianteeman
Copy link
Contributor

Almost but not quite

Data Entry

image

After Save

image

@brianteeman
Copy link
Contributor

For the farsi changes it needs to be tested by a native speaker but as far as I can tell it does not work as described in the PR. Instead of a fatal error you get an invalid date message - which is better than it is now but not as described

@tkuschel
Copy link
Contributor Author

@brianteeman : After checkout, did you make a
npm ci
in your test environment?
The invalid data message only appears if the javascript is not build into compressed form.

@brianteeman
Copy link
Contributor

yes of course

@brianteeman
Copy link
Contributor

chrome_3Zd10YWrT9.mp4

@tkuschel
Copy link
Contributor Author

@brianteeman Can you tell me your test environment:

  1. Used Web browser,
  2. Server nginx, ...
  3. OS
  4. Which kind of message do you get / output?
    So I can look at it again.

@brianteeman
Copy link
Contributor

did you test using arabic or were you pasting an english character date? From looking at your code you are assuming that the year is in the gregorian calendar. ie 1900 or 2000. ~The current year in the jalali calendar is 1404

@tkuschel
Copy link
Contributor Author

I did not translate the date in the error message to jalaali. I know the year 1404. I'll look at the Farsi language, please be patient, as RTL is a little unfamiliar to me.

@brianteeman
Copy link
Contributor

My gut feeling is that this PR is taking the wrong approach. I would just be outputting an error message stating that the input is incorrect and NOT trying to correct it.

@tkuschel
Copy link
Contributor Author

Work in progress, do not test code. Should I close the PR and reopen when I am done?

@brianteeman
Copy link
Contributor

You can close it or change it to a draft

@tkuschel tkuschel closed this Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.3-dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants