Jump to content

[SOLVED] Format Date TUniDateTimePicker mm/dd/yyyy -> dd/mm/yyyy


Alessandro

Recommended Posts

Good Morning.
Do you know how to solve a problem with TUniDateTimePicker?
Come on:
The user does not want to select the date through the dropdown of the component.
It wants to enter the date, without the bars (the component allows).
However, when leaving the field, the date is converted to "mm / dd / yyyy" and I want to keep "dd / MM / yyyy"
Can you help me?
 
See the link below, which occurs:
When typing 04092017 in the field, it should be 04/09/2017 but is converted to 04/09/2017

 

https://youtu.be/3NGID9dfWVM

Link to comment
Share on other sites

  • 4 weeks later...

For example for ExtLocale -> [pt_BR]

UniDateTimePicker1 -> ClientEvents -> UniEvents -> beforeInit fn:

function beforeInit(sender, config)
{
config.altFormats="dmY|m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d|n-j|n/j";
}

 

FOR TIME:

UniDateTimePicker1 -> ClientEvents -> UniEvents -> beforeInit fn:

function beforeInit(sender, config)
{
config.altFormats="g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A";
}

 

Hello!
I have another question about the same problem. Now it is with the TIME field.
When I type 1200, the script changes the text to 12:00 (okay!)!
But, when I type 2000, the script does not change to 20:00. I noticed that the field gives a "2000 is not a valid value" error message. And the maximum the script manages to convert is up to 1259 which transforms to 12:59.
 
I await. Thank you.
Link to comment
Share on other sites

Hi Alessandro,

 

Seems We should tell to timefield Hi :) :)

 

Try this:

function time.beforeInit(sender, config)
{
    config.altFormats="Hi|g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A";
}

Best regards,

  • Upvote 1
Link to comment
Share on other sites

Hi Alessandro,

 

Seems We should tell to timefield Hi :) :)

 

Try this:

function time.beforeInit(sender, config)
{
    config.altFormats="Hi|g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A";
}

Best regards,

 

THANKS!!! :)

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...