Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Date Formatting bug with JSON Date
26/07/2010
18:08
Avatar
nomad513
New Member
Members
Forum Posts: 2
Member Since:
19/02/2010
sp_UserOfflineSmall Offline

My dates are being returned from the server via JSON in this format:  "March, 31 2009 14:41:25"

I setup the formatoptions.srcformat on my date column as 'F, d Y H:i:s' and the formatoptions.newformat as 'm/d/Y'

My result is 01/31/2009, but should be 03/31/2009.

I have tracked the issue down to the jquery.fmatter.js file, lines 110 - 126.  I found several issues.

1) Line 110 & 111: The regex for date & format variables does not account for a comma.  Adding \, seems to address this.

2) Line 119 & 120: Nothing ever uses the 'dM' variable.  I altered this to instead set the result to 'date[k]'.

3) Line 120: Adding +1 to the numeric month gives incorrect result.  JS months are zero based 0-11.  I removed the +1.

4) Line 126: In my format, I did not use 'm', I used 'F'.  There is no code to set 'm' from 'F' once the numeric month has been determined.  I added a line before this of 'if (ts.f) {ts.m = ts.f;}'.

Making these 4 alterations addresses the issue I found.

Thanks

03/08/2010
12:12
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thanks for 1,2 and 4. Fixed.

The 3) is not true. below these lines later we decrement the mouth value.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
25 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information