TRzDateTimeEdit not working with format date

Components on the Raize Edits palette: edits, button edits, date-time edits, spin edits, color edits, memos, track bars, etc.

TRzDateTimeEdit not working with format date

Postby lanco » Tue May 23, 2017 5:10 pm

Hi All,
When I set Format Date to 'dddddd' or 'dd mmm yyyy' and click button 'Today' on Calendar, I see date '24 may 2017', it's ok.
But, when RzDateTimeEdit lost focus date is clear and RzDateTimeEdit stay empty.

With empty Format Date is ok.

How can I change Date Format in properties editor or in runtime ?

Pawel L.
lanco
 
Posts: 3
Joined:
Mon May 22, 2017 8:15 am

Re: TRzDateTimeEdit not working with format date

Postby Raize Support » Thu May 25, 2017 1:13 am

Hi Pawel,

I just created a test project in Delphi 10.2 and was not able to duplicate the behavior you describe. Do you have any other event handlers assigned to the control?

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 622
Joined:
Fri Mar 25, 2011 9:04 pm

Re: TRzDateTimeEdit not working with format date

Postby lanco » Wed May 31, 2017 6:47 am

Hi Ray,

problem is with parcing date from edit with different local seting.
After lose focus TRzDateTimeEdit can't read date in format for eg. 'dd mmm yyyy' because my local seting is 'yyyy-mm-dd' and clear data.
I'm working with Win10 Polish version, in Vietnam with English Windows it works different.

Paul
lanco
 
Posts: 3
Joined:
Mon May 22, 2017 8:15 am

Re: TRzDateTimeEdit not working with format date

Postby Raize Support » Wed May 31, 2017 2:21 pm

Hi Paul,

Thanks for the additional information. The issue that you are running into is a result of the control allowing free form data entry and the FormatDate property is in conflict with the locale specific short date, which is causing the parsing error. The control uses the locale specific short date format to parse the date values. As such, the parser does its best to match up the data that is entered with the ShortDateFormat structure. Your system's ShortDateFormat is essentially YMD, but you are formatting the date to be DMY. Using today's date as an example '31 May 2017', the first token is 31, which gets matched to the Year because of the ShortDateFormat. As a result, the other values do not match up.

Technically, it is possible for the control to use the FormatDate property structure (e.g. DMY) to parse the date. However, the biggest problem with this is that a fundamental goal of the control is to allow free form date entry for the user using the format they have selected for their environment. Overriding this behavior is tricky because the unless you display the format to the user, they will have no idea what the structure of the date format will be.

Of course, the counter argument to this is that the control should not raise and exception in this situation. However, even if the control were to use the FormatDate structure for parsing, the opposite issue would occur. If the user entered the date in their chosen format, the parsing would fail because the structures would mismatch.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 622
Joined:
Fri Mar 25, 2011 9:04 pm

Re: TRzDateTimeEdit not working with format date

Postby lanco » Thu Jun 01, 2017 5:48 am

Hi Ray,
in that situation I don't know what for is propertie FormatDate when I can't use it.
I choose date from calendar and see '31 may 2017' in my format dd mmm yyyy', Why control not use my format to parce date ?
My brother use my program in Vietnam and it works different.

Paul
lanco
 
Posts: 3
Joined:
Mon May 22, 2017 8:15 am

Re: TRzDateTimeEdit not working with format date

Postby David Marcus » Thu Jun 01, 2017 10:54 am

The way that I do it is I check whether the user's short date format is using a MDY order and if it is, I set the format to 'mmmm d, yyyy'. Otherwise, I let it use the user's format.
David Marcus
 
Posts: 69
Joined:
Thu Aug 11, 2011 11:29 pm
Location: Somerville, MA, USA


Return to Edits

Who is online

Users browsing this forum: No registered users and 2 guests

cron