Jump to content

Why Entering dd/mm/yyyy In TUniDateTimePicker Results In mm/dd/yyyy In Version 1.90.0.1535?


Frederick

Recommended Posts

1 hour ago, Frederick said:

entering a date in the format of dd/mm/yyyy results in mm/dd/yyyy.

Can you try this approach?:

UniDateTimePicker.ClientEvents.ExtEvents ->

function afterrender(sender, eOpts)
{
    sender.altFormats = 'dmY|'+sender.altFormats;  
}

 

Link to comment
Share on other sites

2 hours ago, Farshad Mohajeri said:

We have fixed a bug in 1535 which was avoiding loading correct Locale file into web app.

As a result file locale-en_GB.js  is now loaded into your session which sets default format to "d/m/Y"


Ext.Date.defaultDateFormat = "d/m/Y";

To fix this you must explicitly set your date format in Delphi.

As in ShortDateFormat:='dd/mm/yyyy'?

Link to comment
Share on other sites

7 hours ago, Farshad Mohajeri said:

Yes


 PFmtSettings.ShortDateFormat :='dd/mm/yyyy';

Actually you need to check your DatePicker.DateFormat first

 

I have checked my TUniDateTimePicker's DateFormat property and it is always 'dd/MM/yyyy' once it is dropped on a form. It must be following my regional settings.

I'll re-install 1.90.0.1535 later and post the result here.

Thanks.

Link to comment
Share on other sites

Farshad,

I am afraid that setting the ShortDateFormat to 'dd/mm/yyyy' does not fix the problem with TUniDateTimePicker in version 1.90.0.1535.

In the video I have attached, my first date entry was 1st August 2020 (010820). UniGUI changes the date to 08/01/2020 which is equivalent to 8th January 2020. The second date entry is for 31st December 2020 (311220). UniGUI changes the border of TUniDateTimePicker to red, indicating an invalid date entry..

Link to comment
Share on other sites

On 8/14/2020 at 4:20 PM, Frederick said:

As a check, I removed 1535 and re-installed 1534 and the date entry, as per the video attached, was correct.

 

On 8/14/2020 at 2:33 PM, Sherzod said:

function afterrender(sender, eOpts) { sender.altFormats = 'dmY|'+sender.altFormats;  }

This should work for 08012020

For 08012020 and 080120 use:

function afterrender(sender, eOpts)
{
    sender.altFormats = 'dmY|dmy|'+sender.altFormats;
}

 

Otherwise, make a test case or let me connect to your PC. 

Link to comment
Share on other sites

5 hours ago, Farshad Mohajeri said:

What is your system locale?

You can test it by opening the source page.

At top you will see:


<!DOCTYPE html>
<html lang="en-GB">

What is the lang parameter for your?

The top of the source file shows the following:-

<!DOCTYPE html>
<html lang="en_GB">

   
Link to comment
Share on other sites

6 hours ago, Sherzod said:

 

This should work for 08012020

For 08012020 and 080120 use:


function afterrender(sender, eOpts)
{
    sender.altFormats = 'dmY|dmy|'+sender.altFormats;
}

 

Otherwise, make a test case or let me connect to your PC. 

Sherzod,

This code works but I would like to send you the project anyway to investigate why I need another line of code in the event property to have it work. This would be back breaking work to have to retrofit all my TUniDateTimePicker / TUniDBDateTimePicker controls.

ddmmyyyy.zip

Link to comment
Share on other sites

in your mainform

properties/script-> add

Ext.QuickTips.init();
Ext.form.field.Date.prototype.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";

 

image.thumb.png.cadd69429d55ce720e10cbb35e278e33.png

this will affect all controls in your project


It is legal that the user can only enter the numerical part, which will be added to the bars.
your user types
25122020 (ddmmyyyy)
will be changed to
25/12/2020

 


 

 

 

 

Link to comment
Share on other sites

4 hours ago, wilton_rad said:

in your mainform

properties/script-> add

Ext.QuickTips.init();
Ext.form.field.Date.prototype.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";

<image>

this will affect all controls in your project


It is legal that the user can only enter the numerical part, which will be added to the bars.
your user types
25122020 (ddmmyyyy)
will be changed to
25/12/2020

Thanks, but unfortunately, it does not work. It seems that only the suggestion from Sherzod to add the code in the TUniDateTimePicker's ClientEvents.UniEvents.BeforeInit works for now.

 

Link to comment
Share on other sites

On 16/08/2020 at 01:06, Frederick said:

Obrigado, mas infelizmente não funciona. Parece que apenas a sugestão de Sherzod para adicionar o código no ClientEvents.UniEvents.BeforeInit do TUniDateTimePicker funciona por enquanto.

 

I'm sorry about that, but this code was enough and there were never problems with dates

Link to comment
Share on other sites

4 minutes ago, wilton_rad said:

I'm sorry about that, but this code was enough and there were never problems with dates

No worries. I also never had problems with dates until version 1.90.0.1535. I have temporarily moved back to 1.90.0.1534 and am waiting to see if the next version after 1535 will fix it without me having to add the JS code for each and every date control.

Thanks for your help anyway.

Link to comment
Share on other sites

  • 3 weeks later...
1 hour ago, d.bernaert said:

So there is no fix for this for the moment without going over all the controls and adding the extra code?

I have around 300 forms...

Hi Dominique,

MainForm.Script:

Ext.form.field.Date.prototype.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";

 

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...