Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: day of week in Safari RSS



On Nov 30, 2005, at 8:19 AM, Mark Pilgrim wrote:

On 11/30/05, Ilan Volow <email@hidden> wrote:
let $date := replace($date, ".*?,?\W*(\d+)\W*(\w+)\W*(\d+)\W*(\d {2}:\d
{2}:\d{2})\W*(-|\+)(\d{1,2})(\d{2}$)", concat("$3-", $month, "-$1T$4
$50$6:$7"))

FWIW, the feed validator also uses regular expressions to validate RFC (2)822-style dates. Not sure why any client would want to be this strict, but since Safari/WebCore is currently being too strict, the following regular expression could be viewed as an improvement. It also has the benefit of being well unit-tested.

From http://cvs.sourceforge.net/viewcvs.py/feedvalidator/ feedvalidator/src/feedvalidator/validators.py?view=markup

class rfc822(text):
rfc822_re = re.compile("(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)| (Sun)), *)?" +
"\d\d? +((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)| (Oct)|" +
"(Nov)|(Dec)) +\d\d(\d\d)? +\d\d:\d\d(:\d\d)? +(([+-]?\d\d\d \d)|" +
"(UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|\w)$")
def validate(self):
if not self.rfc822_re.match(self.value):
self.log(InvalidRFC2822Date({"parent":self.parent.name,
"element":self.name, "value":self.value}))
else:
self.log(ValidRFC2822Date({"parent":self.parent.name,
"element":self.name, "value":self.value}))



That is nice, but that is very USA centric. Other languages won't use "Mon", "Tue".... Then after that, other english speaking countries will have different timezones, such as ACT, LHI, NSW in Australia.


Jim

--

/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
 X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
email@hidden      http://www.FreeBSD.org     The Power to Serve
email@hidden  http://www.TheHousleys.net
---------------------------------------------------------------------
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
syndication-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/syndication-dev/email@hidden

This email sent to email@hidden

References: 
 >day of week in Safari RSS (From: "Douglas Maus" <email@hidden>)
 >Re: day of week in Safari RSS (From: Ilan Volow <email@hidden>)
 >Re: day of week in Safari RSS (From: Mark Pilgrim <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.