Closed Bug 468020 Opened 16 years ago Closed 16 years ago

Regex used to parse RFC3339 dates is incorrect

Categories

(Calendar :: Provider: GData, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: clokep, Assigned: clokep)

Details

(Whiteboard: [gdata-next])

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3pre) Gecko/20081201 Lightning/1.0pre Thunderbird/3.0b1

The regex given in the function fromRFC3339 to parse the RFC 3339 string is incorrect (in calGoogleUtils.js). It uses is trying to escape a period (.) for use with fraction of a second, but since it is contained within a string TWO back slashes are needed, not one.  This causes the wildcard (.) to match the first three characters of the timezone offset (i.e. -05) thinking its a fraction of a second.

Reproducible: Always

Steps to Reproduce:
Call the fromRFC3339 string with a RFC 3339 string formatted with a timezone (2008-12-04T21:10:00-05:00)
Actual Results:  
The regex matches the following:
year=2008
month=12
day=04
hour=21
minute=10
second=00
fraction-of-a-second=-05
With the timezone offset being unmatched

Expected Results:  
It matches the following:
year=2008
month=12
day=04
hour=21
minute=10
second=00
fraction-of-a-second unmatched
timezone-offset-hours=-05
timezone-offset-minutes=00
Attached patch Regex Fix — — Splinter Review
Attachment #351506 - Flags: review?(daniel.boelzle)
Attachment #351506 - Flags: review?(daniel.boelzle) → review?(philipp)
Comment on attachment 351506 [details] [diff] [review]
Regex Fix

Thanks for the patch. Fortunately, I haven't seen Google ever spit out split seconds in their dates. The fix is nevertheless needed though.
Attachment #351506 - Flags: review?(philipp) → review+
A testsuite for these dates might be nice, requesting in-testsuite
Assignee: nobody → DarkJedi613
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: in-testsuite?
Keywords: checkin-needed
OS: Windows Vista → All
Hardware: PC → All
Whiteboard: [gdata-next]
Checked in: http://hg.mozilla.org/comm-central/rev/031732472726

Please change status/fields as appropriate.
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.0
These bugs are likely targeted at Lightning 1.0b1, not Lightning 1.0. If this change was done in error, please adjust the target milestone to its correct value. To filter on this bugspam, you can use "lightning-10-target-move".
Target Milestone: 1.0 → 1.0b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: