ISO 8601 parser and unparser

Additions to convert an ISO 8601 string to an NSCalendarDate and back


Description

ISO 8601 provides a standard unambiguous format (several, actually) for dates and times. Unfortunately, NSDateFormatter alone does not completely support ISO 8601; in particular, it does not support week dates or ordinal dates.

This came to my attention when I began writing a patch for Vienna to add support for the ttl element of RSS 2.0 and the updatePeriod, updateFrequency, and updateBase elements of RDF Site Summary 1.0's Syndication module (which it borrowed from Open Content Syndication). The latter prescribes a YYYY-MM-DDTHH:MM format for dates. Somehow, I got it into my head that it prescribed ISO 8601 format for dates (as opposed to only the YYYY-MM-DDTHH:MM format), which would have meant that NSDateFormatter wouldn't work.

So, that's why I wrote this parser. On the whole, I think it works out.


Version history

Version 0.3 fixed some bugs found by Colin Barrett.

In version 0.2, I added an unparser. Now you can go back and forth between NSCalendarDate and NSString.


Downloads

ISO-8601-parser-0.3.tbz
Objective-C source code and test programs, with Makefile, in a bzip2ed tarball.
128-bit FNV1 hash: e447290e6255e9d97ed928a63f691097
MD5 hash: c7ffb4705df004b4e0b46189838da408
SHA-1 hash: 5674dff4ddcb384074884e198018a55cf80e4c42
ISO-8601-parser-0.3.zip
Objective-C source code and test programs, with Makefile, in a zip archive.
128-bit FNV1 hash: 991c043ffb1afbc640387b23e1861e84
MD5 hash: 4af597d2323f1e2a843fca450e392a56
SHA-1 hash: 418cad06341a5b5e75d361dd4b2b73b05bfbfdae
ISO-8601-parser-0.2.zip
Objective-C source code and test programs, with Makefile, in a zip archive.
128-bit FNV1 hash: 02de77118b20caa131868886fcb38855
MD5 hash: 6ab26168658c4531dca421e57b2707fa
SHA-1 hash: 71fe5d1c328fe0076f06674c2be05b8ed662771b
ISO-8601-parser-0.1.zip
Objective-C source code and test program, with Makefile, in a zip archive.
128-bit FNV1 hash: a4bc4a73c17fabd597a38921e378257c
MD5 hash: c0499f8f48f82b6787b24a618c612854
SHA-1 hash: 8d97f8c7bc6865f2efc12bac70545de99a14fe92

MD5 and SHA1 signatures were created using the md5sum(1) and sha1sum(1) utilities from GNU coreutils.


2006-06-06 http://oocities.com/iamtheboredzo/iso8601parser
Valid XHTML 1.0! Valid CSS!