This is a migrated thread and some comments may be shown as answers.

[Solved] Date format is wrong

2 Answers 149 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Troy Demet
Top achievements
Rank 2
Troy Demet asked on 21 Feb 2012, 09:56 PM
I am using the DateTime picker and since the update to 2012.1.214 the control is taking a date formatted as 6/13/2012 and changing it to 2012-06-13. I have set the culture and uiCulture of the site to en-US.
Any suggestions on correcting this would be greatly appreciated.

-Troy

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 23 Feb 2012, 01:20 PM
Hello Troy,

 Do you experience the same problem in our online demos? I am asking this because they are using the 2012.1.214 version with US culture and I was not able to reproduce the problem there.
If you experience the problem in the demos, please provide reproduction steps so we can investigate further.

Kind regards,
Georgi Tunev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Jon
Top achievements
Rank 1
answered on 17 Apr 2012, 05:21 PM
Sorry to hijack this thread, but I can confirm the same bug as the original poster. My model property is a nullable datetime that has a value. Formatting does not occur. Instead of getting my format "17-Apr-2012" the value is set to "2012-04-17T05:00:00Z".

This is driving me crazy and I have been unable to prevent the behavior. All your demos work fine for me. The DatePicker works correctly everywhere else in my app except for this one scenario.

The only additional information I can tell you is that I am building the DatePicker in code which is called during an Html.Partial call that is being used to display a jQuery dialog

var result = _html.Telerik().DatePickerFor(expression).Format(Constants.DateFormat2).ToHtmlString();
return MvcHtmlString.Create(result);

UPDATE: The value "2012-04-17T05:00:00Z" is what is in ModelState. It seems that under certain conditions, the raw value from ModelState is used at the initial value in the datepicker.


Tags
Date/Time Pickers
Asked by
Troy Demet
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Jon
Top achievements
Rank 1
Share this question
or