CalendarEdit in XE5 Firemonkey - using iOS (bug?)

I'm saving and loading data from a TCalendarEdit. I've noticed that if I use a date before 1960 (I haven't narrowed it down more than that) I can end up in the wrong century when I load the data. 

Here's how I'm saving:
{code}
  lINI := TMemINIFile.Create(TPath.GetDocumentsPath + PathDelim + 'Settings.ini');

  lINI.WriteDate('Test', 'DOB', CalendarEdit1.Date);
  lINI.UpdateFile; {code}

Here's how I'm loading:
{code}  lINI := TMemINIFile.Create(TPath.GetDocumentsPath + PathDelim + 'Settings.ini');

  lDate := lINI.ReadDate('Test', 'DOB', 0);
  CalendarEdit1.Date := lDate; {code}

Example run: I set date to 1/1/1955 then hit save. I then hit load and my date is set to 1/1/2055. 

The calendar edit only shows the last two digits of the year so you don't notice it until you actually click on the edit again, my guess is that this part of the problem.

I have found an easy work around saving the data using a string: FormatDateTime('m/d/yyyy', CalendarEdit1.Date) I thought I would post something about it here in case this is a bug.  Is it?
0
Michael
2/6/2014 6:10:39 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

2 Replies
1785 Views

Similar Articles

[PageSpeed] 22

I think this explains it: 
http://docwiki.embarcadero.com/Libraries/XE5/en/System.SysUtils.TFormatSettings.TwoDigitYearCenturyWindow 
In short, it's a 50 year window by default. So, today 1/1/00 to 2/6/64 
(or today +50 years) are the 21st Century. 2/7/64 to 12/31/99 would be 
the 20th Century. If you don't like that, set TwoDigitYearCenturyWindow 
or use 4 digit years (as you have discovered).

Michael McFarland wrote:
> I'm saving and loading data from a TCalendarEdit. I've noticed that if I use a date before 1960 (I haven't narrowed it down more than that) I can end up in the wrong century when I load the data.
>
> Here's how I'm saving:
> {code}
>    lINI := TMemINIFile.Create(TPath.GetDocumentsPath + PathDelim + 'Settings.ini');
>
>    lINI.WriteDate('Test', 'DOB', CalendarEdit1.Date);
>    lINI.UpdateFile; {code}
>
> Here's how I'm loading:
> {code}  lINI := TMemINIFile.Create(TPath.GetDocumentsPath + PathDelim + 'Settings.ini');
>
>    lDate := lINI.ReadDate('Test', 'DOB', 0);
>    CalendarEdit1.Date := lDate; {code}
>
> Example run: I set date to 1/1/1955 then hit save. I then hit load and my date is set to 1/1/2055.
>
> The calendar edit only shows the last two digits of the year so you don't notice it until you actually click on the edit again, my guess is that this part of the problem.
>
> I have found an easy work around saving the data using a string: FormatDateTime('m/d/yyyy', CalendarEdit1.Date) I thought I would post something about it here in case this is a bug.  Is it?
>
0
quinn
2/6/2014 9:03:39 PM
> {quote:title=quinn wildman wrote:}{quote}
> I think this explains it: 
> http://docwiki.embarcadero.com/Libraries/XE5/en/System.SysUtils.TFormatSettings.TwoDigitYearCenturyWindow 
> In short, it's a 50 year window by default. So, today 1/1/00 to 2/6/64 
> (or today +50 years) are the 21st Century. 2/7/64 to 12/31/99 would be 
> the 20th Century. If you don't like that, set TwoDigitYearCenturyWindow 
> or use 4 digit years (as you have discovered).
> 

Thanks for the explanation, I didn't know about that setting.
0
Michael
2/10/2014 4:35:43 PM
Reply:

Similar Artilces:

Delphi iOS 7 firemonkey xe5 VideoZoomFactor unimplemented
Hi, I want to use the new IOS 7 AVCaptureDevice feature VideoZoomFactor in Delphi XE5 but the feature hasn't been implemented. Is there a good way to use features that haven't yet been added to base objects in delphi? Are those header files, like IOSapi.AVFoundation.pas machine generated? I modified the files FX.Media.IOS, iOSap.AVFoundation and FMX.Media to add the missing feature i wanted and recompiled. That worked for this feature, but I would like to find a better way. is there a timetable to releasing the iOS 7 features in firemonkey? I was kind of surprised to find i...

Installing components for FireMonkey HD and FireMonkey iOS
Hi, How do I install components for both FireMonkey HD and FireMonkey iOS? I have one package 'FMXMyFireMonkeyControl' and 'FMIFireMonkeyControl' which both point to the same file with the same registration 'TFireMonkeyControl'. If I compile one package (FMXMyFireMonkeyControl) it installs correctly, then change the include file (FMCompile.INC) to compile for IOS (FMIFireMonkeyControl) which is included in the FMX.FireMonkeyControl.pas file: {$I FMCOMPILE.INC} uses {$IFDEF COMPILEIOS} FMX_Types, FMX_Objects, FMX_Forms, FMX_Dialogs, FMX_Effe...

Delphi XE4 - Firemonkey
I have an application that runs fine on windows, however when running on iOS simulator the onKeyUp event for a TEdit control is not being fired? Please advise if this event should get fired when running on iOS? This problem occurs onKeyUp events created directly on the control and by assigning the event programatically. Running XE4 update 1 iPhoneOS6.1.sdk Minimac: OS X 10.9 XCode 5 iOS Simulator Version 7.0 - iPad Retina / iOS 7.0.3(11B508) ...

XE5 Bug in TStringList for Firemonkey mobile
Hi All the while, i was working with Delphi 6 and i had not problems with TStringList until shifted to XE5 and found that TStringList has a new type of constructor Create call. TStringList.create(OwnObject) which lets the TStringList to free the objects once the item is deleted. Now, i created 2 StringList. One that is NOT OWNED by TStringList called TNotOwnList and another OWNED TListOwnList I have my own data object called TmyData which is derived from TObject. When the form is created, i populated 2 string list with myData objects. I created 2 buttons. Each to remove the objec...

Delphi, Firemonkey, IOS, and TCP howto?
I was really excited about the new ability to compile IOS apps written in Delphi, but I'm starting to find some major limitations, unless I'm really overlooking something. I want to write an iphone/pad app that needs to retrieve data from a socket connection, or from a webpage (http, webservice, anything). It seems that all of the Firemonkey internet and indy components are not supported within xcode. Am I overlooking something here, or is this a feature that will not be implemented, or is it planned to be implemented? If this kind of communication is not supported, this is a hu...

Delphi XE5 Firemonkey iOS7 Style (where is it?)
It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" Where is the iOS7 style? - All I can see is iOS6 style components. I can compile on iOS7 and it will bring up the keyboard in iOS 7 but none of the drag and drop components from firemonkey are iOS7 style. Am I missing something obvious? > {quote:title=David Templar wrote:}{quote} > It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" > > Where is the iOS7 style? - All I can see is...

XE5 FireMonkey
I have seen how to set permissions on an Android app to read contacts, but have not found anything about how to read the contacts for an IOS app. Does anyone know how - or better yet have an example of reading IOS contacts (name, email, phone #, etc...) and putting them in a list box? Tanks, Glenn House ...

Ann: FastReport FMX for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

XE5 FireMonkey IOS and TWebBrowser Refresh? [Edit]
Hi! I'm using TWebBrowser to embed some php pages in my mobile app. How do i refresh those pages like WebBrowser.Refresh in VCL. Also TWebBrowser seems to crash if there is a heavy load of graphics etc. on my php pages so i have to keep the pages quite memory low... It is buggy as hell and the offset of TWebBrowser seems to be wrong... Edited by: Haakon A. Myhra on Oct 15, 2013 4:02 AM ...

Ann: X-platform report generator for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Download Latest version of Delphi XE5 Firemonkey 3
Hello I have a number of bugs in my Android application that seem to be firemonkey issues not my application. I am simply trying to find the latest version for XE5. I have a licenced Enterprise edition at Update 2 level. All I can find are free trial of XE6, The EDN website seems very slow often clicking on front page items with no response. Where can I check I have the latest version of my installed software please? Delphi + Firemonkey Registered user download area is what you want. Steps: 1. http://members.embarcadero.com 2. Login using the same crededtials you used to regist...

How do you rate you experience programming for IOS in Delphi/Firemonkey [Edit]
Hello: I've been taking a IOS programming course in objective-c/swift with xcode, and while doing my homework assignments I came to the conclusion that this is a very finicky environment, where very often things don't work as expected or there is always some minor UI glitch that has to be fixed or found workarounds for. Just to give you some examples (by far not an exaustive list): a UITableView doesn't align to the top when you use a navigation controller; upon selecting a row in a UITableView some buttons in the row disappear while the row is selected; specifying layout con...

Implementing a sip client on delphi xe4 firemonkey for iOS
:-) I need to develop a voice and video SIPclient for iOS using XE4 Firemonkey. What the best way to do this? It´s SIP supported by Firemonkey? Are there any APIs? Regards Gustavo wrote: > I need to develop a voice and video SIPclient for iOS using > XE4 Firemonkey. What the best way to do this? Good luck. SIP is not a trivial protocol to implement manually. You are best off finding a pre-made SIP library to do the work for you. > It´s SIP supported by Firemonkey? I seriously doubt it. > Are there any APIs? SIP is an application-layer proto...

Firemonkey iOS 8 Lupe / Textzoom causes BUG
Hi, if I align my EditBox oder my Memo field on "top" and try to edit the text I just typed in the app crashes. Using Delphi Xe7. Any way to fix that!? ...

[XE4] [IOS] A bug on firemonkey's MeasureText?
Place one label , one memo, and one button on form. Run the code below. the result is so strange. The Label1.Height is not correct with 2 method below. Is this a bug ?? {code} function MyMeasureText(canvas: TCanvas; AText: string; width: single): single; var R: TRectF; begin R := RectF(0, 0, width, 10000); canvas.MeasureText(R, AText, False, [], TTextAlign.taLeading, TTextAlign.taLeading); Result := R.Bottom * 2; end; procedure TTabbedwithNavigationForm.Button1Click(Sender: TObject); begin Label1.Height := 25; Label1.Text := '1. This is line one,...

Web resources about - CalendarEdit in XE5 Firemonkey - using iOS (bug?) - embarcadero.delphi.firemonkey

Resources last updated: 1/16/2016 2:00:52 PM