SmartDate and DevExpress ASPxDateEdit Value (FYI)

SmartDate and DevExpress ASPxDateEdit Value (FYI)

Old forum URL: forums.lhotka.net/forums/t/11210.aspx


SNiedinger posted on Tuesday, March 06, 2012

Hi,

FYI,

I have been chasing a bug this morning where a date was not properly saved.

I turned out that when initialising the ASPxDateEdit Value property to a SmartDate it converts the date into a 'US actual date' (i.e. swaps day and month) I use British regional settings (dd/M/yyyy).

E.g.

SmartDate value is 6 March 2012

when setting the ASPxDateEdit Value property the ASPxDateEdit date actually becomes 3 June 2012 !

when setting the ASPxDateEdit Date property it works correctly.

 

As a test I converted the SmarteDate properties in my business object to DateTime? types and then the ASPxDateEdit  worked fine. (both Value and Date properties)

Question:

DateTime? should be fine for our needs, but would prefer to use SmartDate. Are there any issues in using DateTime?

Thank you,

Siegfried

 

 

 

 

 

 

 

 

JonnyBee replied on Tuesday, March 06, 2012

DefaultFormat for SmartDate is "d" .

Do you use remote dataportal?

This code in LinqPad (http://www.linqpad.net):

var sd = new SmartDate(DateTime.Now);
sd.Text.Dump();
sd.FormatString.Dump();

gives this output:

06.03.2012
d

Which is correct for my locale setting in Norway.

Could the real issue be the ASPxDateEdit and how it parses text to DateTime? 


Copyright (c) Marimer LLC