Wrong date value when picking a date by DateTime picker

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mansour
User
Posts: 309

Wrong date value when picking a date by DateTime picker

Post by mansour »

Hi,
My default language is fa-IR and also my locale is set to fa-IR.
When I try to pick a date the value of the date is wrong. (The DateTime picker shows correct Persian calendar.)
e.g. when I try to pick 5/23/2054 (1402/03/03 in Hejri shamsi) the value of the date field is : Y-۲۵-۲۳ ۱۰:۲۵
What's the problem ?
Thanks


mobhar
User
Posts: 11793

Post by mobhar »

When you said it display the wrong date value, then what should be the correct one? Can you explain it in more detail?


mansour
User
Posts: 309

Post by mansour »

Hi,
The calendar displayed correctly but after the date selection, the value of the field is NOT correct.
I selected 1403/03/03 (hejri shamsi) on the calendat but the value of the field shows as "Y-۲۵-۲۳ ۱۰:۲۵".
It should be 1403/03/03 or 2024/05/23

Thanks


mansour
User
Posts: 309

Post by mansour »

Hi,
The console error:

Luxon failed to parse the input date.
tempus-dominus.js?v=24.11.0:4742

thanks


arbei
User
Posts: 9532

Post by arbei »

mansour wrote:

e.g. when I try to pick 5/23/2054 (1402/03/03 in Hejri shamsi)...

mansour wrote:

I selected 1403/03/03 (hejri shamsi) on the calendat but the value of the field shows as "Y-۲۵-۲۳ ۱۰:۲۵".

  1. The date/time picker does not support Persian calendar,
  2. If your locale is "fa-IR", the correct format is "y/M/d", e.g. "2024/5/23", other formats are incorrect and cannot be parsed,
  3. If your database stores date values like "1402/03/03", the date/time picker will try to show but it will fail. When you select the date it returns a wrong date.
  4. You need to make sure your dates stored in the database are in the correct format, i.e. "y/M/d", e.g. "2024/5/23".

mansour
User
Posts: 309

Post by mansour »

Hi,
I found the problem is related to Locale setting. I removed the locale file for fa-IR, and the problem is fixed. Finally, I changed the date format to yyyy/MM/dd.
Thanks


Post Reply