Date Picker and FieldSetup -> Format Date/Time (dmyHis)

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

Date Picker and FieldSetup -> Format Date/Time (dmyHis)

Post by phpmakerfan »

If I use the Date/Time format for a field with 'Date/Time named format' dmyHis and in validation I select 'Use date/time picker' then the date/time picker is still in format dmYHis (not dmyHis) and I'm not able to edit or add this record because the validation.

I tried to change this to Tool => Extensions => Date/Time Picker => Advanced but when i see the source of the edit-page is still on "format":17

Is this something I can fix?


mobhar
User
Posts: 11703

Post by mobhar »

Simply click on "Tools" -> "Locale Settings" -> select the language you are using for your project, adjust the date format, then re-generate ALL the script files again.

If you host your web application to live server, then make sure you have already also re-uploaded all the files under the generated "phplocale" sub-folder.


phpmakerfan
User
Posts: 17

Post by phpmakerfan »

As a wrote I did change the format. I tried with {"format":"MM/YYYY"} (see on the website of third-party tools: http :// eonasdan.github.io / bootstrap-datetimepicker / #custom-formats).

But this does not help.


mobhar
User
Posts: 11703

Post by mobhar »

You cannot change the format to MM/YYYY since it contains the separator and this format is not supported by PHPMaker. Date format should represents date, month, and year values, and also without separator.


phpmakerfan
User
Posts: 17

Post by phpmakerfan »

mobhar: did you read the page I wrote earlier? "MM/YYYY" was only an example..

The case is this: In filed settings you can choose dmyHis (Date/Time with 2digit-dayofmonth, 2-digit-monthofyear, 2-digit-year, 2-digit-hour, 2-digit-minute, 2-digit-seconds) as format. But the DateTime Picker (Extension of phpmaker, I'm registered user) have year always as 4 digit value.

Do you know what JSON string I have to put in extension-configuration (Tools => Extension) that I can have a DateTime Picker with a 2-digit-year?


sangnandar
User
Posts: 980

Post by sangnandar »

According to this: github . com / Eonasdan/bootstrap-datetimepicker/pull/666
It doesn't naturally support short year format. But it introduced extraFormat to nested short year inside long year.

Since it used moment also check moment language files <app folder>\moment\locale , it might be something there.

AND...
Please post your final/working code. This thing could become handy :)

Good luck.


mobhar
User
Posts: 11703

Post by mobhar »

phpmakerfan wrote:
i see the source of the edit-page is still on "format":17

After "format":17

add this code at the same line above:
, "extraFormats": "DD.MM.YY"

So the final result should be like this:
"format":17, "extraFormats": "DD.MM.YY"

I've just tried, and it works properly. In other words, at the moment, you need to customize the generated script file.

Note, adding "extraFormats": "DD.MM.YY" code in "Options" section of DateTimePicker extension seems not be applied in the generated script files. I think this is something that needs to be checked by PHPMaker Developer Team.


phpmakerfan
User
Posts: 17

Post by phpmakerfan »

Thanks mobar. But you know: to change generated pages cant be the solution.

I am a registered user and I contacted support and they did send me a new extension for DateTimePicker.


Post Reply