

xmlDate library
Overview
xmlDate is a variation of the native javascript Date object, which can be use to handle RFC3339, W3C datetime or a subset of ISO8601.
xmlDate can also have a given timezoneOffset, which overrides the default timezoneOffset.
xmlDate also implements a tz database parser and resolver based on Olson's tz database, see also Sources for Time Zone and Daylight Saving Time Data.
Summary
The xmlDate runs in underlayer a javascript Date object instance (only the UTC part).
Differences between xmlDate and Date (Javascript 1.5)
- new xmlDate(dateString) - dateString is a xmlDate string
- new xmlDate(yr_num, mo_num, day_num[, hr_num[, min_num[, sec_num[, ms_num]]]]) NOT IMPLEMENTED
- valueOf()- same as getTime()
- toSource() - (new xmlDate(...)) instead (new Date(...)) => Object.toSource() not supported by IE
- toString()- same as toLocaleString()
- Date.UTC(year, month, date[, hrs[, min[, sec[, ms]]]]) NOT IMPLEMENTED
- parse(dateString) - dateString is a xmlDate string
- toUTCString() - return a xmlDate UTC string (Z)
- toGMTString() NOT IMPLEMENTED
- setTimezone(timezoneOffset) - indicates the timezoneOffset to be used
- getYear() NOT IMPLEMENTED
- setYear() NOT IMPLEMENTED
- setFullYear() NOT IMPLEMENTED
- setMonth() NOT IMPLEMENTED
- setDate() NOT IMPLEMENTED
- setHours() NOT IMPLEMENTED
- setMinutes() NOT IMPLEMENTED
- setSeconds() NOT IMPLEMENTED
- setMilliseconds() NOT IMPLEMENTED
- toLocaleString() - return a xmlDate string with timezone, if applicable
- toLocaleDateString() NOT IMPLEMENTED
- toLocaleTimeString() NOT IMPLEMENTED
- setTimezone(timezoneOffset) indicates the offset of the timezone to be used. By default, the Date object timezoneOffset is used.
- setTimezone(timezoneString) indicates the timezone to be used and (partially or fully) parse the tz database.
- getTimezoneOffset([true]) returns the timezoneoffset evaluated from the parsed tz database or when true, returns the timezone code.
Source code
Tested Browsers
- Firefox 1.5.0.3
- Internet Explore 6.0.2900.2180.xpsp_sp2_gdr.050301-1519
Licence
Copyright (C) 2006 Philippe GOETZ
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Feedback
- Mail to philippe.goetz@wanadoo.fr for a Report about xmlDate