PDA

View Full Version : [CLOSED] ModelField DateFormat problem



mirwais
Feb 28, 2013, 12:06 PM
Hi,

I am trying to develop an rss feed viewer loosely based on your "Feed Viewer" combination sample.

I have a problem with a Date type ModelField, which cannot be parsed correctly and is undefined on the client side:


<ext:ModelField Name="pubDate" Type="Date" DateFormat="ddd, dd MMM yyyy HH:mm:ss 'GMT'" />

I have tried .net's DateTime.ParseExact on the server side and it correctly parses the string from my xml file with the provided DateFormat.
Removing the type and dateformat from the modelfield causes the string to be correctly displayed in my grid.

I will provide no code sample, as your Feed Viewer suffers from the same problem (data column in FeedGrid is not populated with data, see 2.1 examples).

Any help will be appreciated

Vladimir
Feb 28, 2013, 12:24 PM
FeedViewer example expects the following format


DateFormat="ddd, dd MMM yyyy HH:mm:ss O"


therefore it correctly parse dates of third feed (Ajaxian)


Fri, 02 Nov 2012 01:59:37 +0000


First and two feeds use the following format (GMT at the end)


Thu, 28 Feb 2013 12:06:49 GMT

Therefore such date is not parsed (ModelField can use only one format)

Please post date which should be parsed by model field in your application

mirwais
Feb 28, 2013, 12:57 PM
Hi Vladimir,

the date format is according to the RSS recommendation: "Thu, 05 Apr 2012 14:53:48 GMT" with the GMT at the end. that is why i tried using DateFormat="ddd, dd MMM yyyy HH:mm:ss 'GMT'".

The thread culture that is currently set is "de-CH", which might be one reason why it is failing, although i tried modifying the feed to change the english abbreviations to german ones and it was still not working propertly.

Vladimir
Feb 28, 2013, 1:54 PM
Try this


ddd, dd MMM yyyy HH:mm:ss \G\M\T


or this


ddd, dd MMM yyyy HH:mm:ss T


Also please ensure that locale file is not rendered by ResourceManager (or ensure that rendered locale is correct for you) because ExtJS uses localized week/month names for date parsing
For example, if set Russian locale (locale set automatically depend from server locale) then 'Thu' will not be parsed correctly because it is not russian week name

mirwais
Mar 01, 2013, 12:33 PM
Hi Vladimir,

I tried both but none of them did it. Where shall i look for the date parsing code (filename in src)?
Anyways, for the moment i will process the rss feed with the SyndicationItem class from microsoft and bind these to my grid.
Can i somehow bind the syndication items directly?

thanks

Vladimir
Mar 01, 2013, 12:40 PM
Can you post here generated html (with generated) script? Just open the page in the browser and choose View Source
Please simplify the page before (only grid to display RSS feeds)

As I said before that if you use German locale then date should contain German week/month names because parsing is localized



Can i somehow bind the syndication items directly?

I don't know, I am not familar with SyndicationItem