      * returns the result in negative minutes, which matches the units
      * used by Date.timezoneOffset
      */
-    private static function parseXSDOffset(xsOffset:String):Number {
+    private static function parseXSDOffset(xsOffset:String):Number
+    {
         var sign:String;
         var hours:Number;
         var minutes:Number;
 
-        if (xsOffset.toLowerCase().charAt(0) == 'z') {
+        if (xsOffset.toLowerCase().charAt(0) == 'z')
+        {
             return 0;
-        } else {
+        }
+        else
+        {
             sign = xsOffset.charAt(0);
-            if ('+-'.indexOf(sign) == -1) {
+            if ('+-'.indexOf(sign) == -1)
+            {
                 return Number.NaN;
             }
-            hours = parseInt(xsOffset.substr(1,2));
-            minutes = parseInt(xsOffset.substr(4,2));
+            hours = parseInt(xsOffset.substr(1, 2));
+            minutes = parseInt(xsOffset.substr(4, 2));
 
             minutes += hours * 60;
             if (sign == '-') minutes = -minutes;

import org.yellcorp.lib.core.StringUtil;


public class XSDDate {

    // http://www.w3.org/TR/xmlschema-2/#dateTime says:
    // '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?

    /**
     * RegExp for matching XSD:DateTimes
     */
    private static var dateTimeRE:RegExp = /(-?\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?([0-9:Z+-]*)/i ;
    //                                      Year      Month   Day     Hour    Minute  Second ms      timezone

    /**
     * RegExp for matching XSD:Times
     */
    private static var timeRE:RegExp     = /(\d{2}):(\d{2}):(\d{2})(\.\d+)?([0-9:Z+-]*)/i ;
    //                                      Hour    Minute  Second ms      timezone

    /**
     * RegExp for matching XSD:Dates
     */
    private static var dateRE:RegExp     = /(-?\d{4})-(\d{2})-(\d{2})/i;
    //                                      Year      Month   Day

    /**
     * Helper function. Returns true if any of its arguments are NaN
     */
    private static function anyIsNaN(... args):Boolean {
        var i:uint;
        for (i=0; i<args.length; i++) {
            if (isNaN(args[i] as Number)) {
                return true;
            }
        }

        }
        else
        {
            throw new ArgumentError("Not a valid xsd:date string");
        }

        return new Date(epoch);
