Frederick Posted August 14, 2020 Share Posted August 14, 2020 I updated my UniGUI from 1.90.0.1534 to 1.90.0.1535 today and now, entering a date in the format of dd/mm/yyyy results in mm/dd/yyyy. This worked in version 1.90.0.1534. What has changed and how do I get back the previous behaviour? -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1535) ddmmyyyydate.mp4 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 14, 2020 Share Posted August 14, 2020 Hello, Are you sure it worked in the previous version? What localization are you using? Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 14, 2020 Author Share Posted August 14, 2020 Yes, it definitely worked previously since I work extensively with dates and I tend to type in dates rather than select from the drop-down box. The TUniDateTimePicker's DateFormat is also set to "dd/MM/yyyy". My localisation setting are as follows? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 14, 2020 Share Posted August 14, 2020 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; } Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 14, 2020 Author Share Posted August 14, 2020 Sorry, the event did not work. As a check, I removed 1535 and re-installed 1534 and the date entry, as per the video attached, was correct. ddmmyyyydate2.mp4 Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 14, 2020 Administrators Share Posted August 14, 2020 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. Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 14, 2020 Author Share Posted August 14, 2020 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'? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 14, 2020 Administrators Share Posted August 14, 2020 Yes PFmtSettings.ShortDateFormat :='dd/mm/yyyy'; Actually you need to check your DatePicker.DateFormat first Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 14, 2020 Author Share Posted August 14, 2020 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. Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 15, 2020 Author Share Posted August 15, 2020 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.. ddmmyyyydate3.mp4 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 15, 2020 Share Posted August 15, 2020 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. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 15, 2020 Administrators Share Posted August 15, 2020 I have implemented a solution which will be available in the next build. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 15, 2020 Administrators Share Posted August 15, 2020 After a further investigation it seems that you have a different problem. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 15, 2020 Administrators Share Posted August 15, 2020 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? Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 15, 2020 Author Share Posted August 15, 2020 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"> Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 15, 2020 Author Share Posted August 15, 2020 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 Quote Link to comment Share on other sites More sharing options...
Wilton Ergon Posted August 15, 2020 Share Posted August 15, 2020 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"; 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 Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 16, 2020 Author Share Posted August 16, 2020 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. Quote Link to comment Share on other sites More sharing options...
Wilton Ergon Posted August 17, 2020 Share Posted August 17, 2020 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 Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 17, 2020 Author Share Posted August 17, 2020 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. Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted September 8, 2020 Share Posted September 8, 2020 Hi, 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... Dominique Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 8, 2020 Share Posted September 8, 2020 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"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.