spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
[TypeConverter] added tests, moving date parsing tests from DATEVALUE to TypeConverterTest
author
Ben Vogt <[email protected]>
date
2017-05-12 23:03:54
stats
4 file(s) changed, 876 insertions(+), 670 deletions(-)
files
README.md
src/Utilities/TypeConverter.ts
tests/Formulas/DateFormulasTest.ts
tests/Utilities/TypeConverterTest.ts
   1diff --git a/README.md b/README.md
   2index 8e781ca..fc59014 100644
   3--- a/README.md
   4+++ b/README.md
   5@@ -44,10 +44,6 @@ helpers to convert, display, and do normal operations with them.
   6 Contingent upon cells having formats or types for primitives.
   7 
   8 
   9-### Test all Date-related functions
  10-Right now we're just using the number of days since 1900, but we should check the other functions.
  11-
  12-
  13 ### Verify that all N-times ({2,9}) are correct, and we're not parsing numbers too big.
  14 
  15 
  16@@ -73,9 +69,6 @@ TypeConverter.
  17 ### Test CriteriaFunctionFactory
  18 
  19 
  20-### Test TypeConverter
  21-
  22-
  23 ### CONVERT could offer more accurate conversions for units in the same system
  24 For example 64 tbs to a qt.
  25 
  26diff --git a/src/Utilities/TypeConverter.ts b/src/Utilities/TypeConverter.ts
  27index f5e4229..36310a4 100644
  28--- a/src/Utilities/TypeConverter.ts
  29+++ b/src/Utilities/TypeConverter.ts
  30@@ -330,7 +330,12 @@ class TypeConverter {
  31    */
  32   public static stringToDateNumber(dateString : string) : number {
  33     // m will be set and valid or invalid, or will remain undefined
  34-    var m = TypeConverter.parseStringToMoment(dateString);
  35+    var m;
  36+    try {
  37+      m = TypeConverter.parseStringToMoment(dateString);
  38+    } catch (e) {
  39+      throw new ValueError("DATEVALUE parameter '" + dateString + "' cannot be parsed to date/time.");
  40+    }
  41     if (m === undefined || !m.isValid()) {
  42       throw new ValueError("DATEVALUE parameter '" + dateString + "' cannot be parsed to date/time.");
  43     }
  44@@ -341,8 +346,9 @@ class TypeConverter {
  45    * Converts any value to a number or throws an error if it cannot coerce it to the number type
  46    * @param value to convert
  47    * @returns {number} to return. Will always return a number or throw an error. Never returns undefined.
  48+   * TODO: This function is far to loosely defined. JS lets anything starting with a digit parse to a number. Not good.
  49    */
  50-  static valueToNumber(value : any) {
  51+  public static valueToNumber(value : any) {
  52     if (typeof value === "number") {
  53       return value;
  54     } else if (typeof value === "string") {
  55@@ -372,7 +378,7 @@ class TypeConverter {
  56    * @param value to conver
  57    * @returns {number} to return. Will always return a number or 0.
  58    */
  59-  static valueToNumberGracefully(value: any) : number {
  60+  public static valueToNumberGracefully(value: any) : number {
  61     try {
  62       return TypeConverter.valueToNumber(value);
  63     } catch (e) {
  64@@ -385,7 +391,7 @@ class TypeConverter {
  65    * @param value to convert
  66    * @returns {boolean} to return.
  67    */
  68-  static valueToBoolean(value: any) {
  69+  public static valueToBoolean(value: any) {
  70     if (typeof value === "number") {
  71       return value !== 0;
  72     } else if (typeof value === "string") {
  73@@ -399,7 +405,7 @@ class TypeConverter {
  74    * @param value of any type, including array. array cannot be empty.
  75    * @returns {string} string representation of value
  76    */
  77-  static valueToString(value: any) : string {
  78+  public static valueToString(value: any) : string {
  79     if (typeof value === "number") {
  80       return value.toString();
  81     } else if (typeof value === "string") {
  82@@ -414,7 +420,7 @@ class TypeConverter {
  83    * @param value to convert
  84    * @returns {number} representing a time value
  85    */
  86-  static valueToTimestampNumber(value: any) : number {
  87+  public static valueToTimestampNumber(value: any) : number {
  88     if (typeof value === "number") {
  89       return value;
  90     } else if (typeof value === "string") {
  91@@ -430,7 +436,7 @@ class TypeConverter {
  92         throw new ValueError("___ expects number values. But '" + value + "' is a text and cannot be coerced to a number.")
  93       }
  94     } else if (typeof value === "boolean") {
  95-      return value ? 1 : 0;
  96+      return 0; // value between 0 and 1, exclusive on 1.
  97     }
  98     return 0;
  99   }
 100@@ -439,8 +445,9 @@ class TypeConverter {
 101    * Returns true if we can coerce it to the number type.
 102    * @param value to coerce
 103    * @returns {boolean} if could be coerced to a number
 104+   TODO: Similar to valueToNumber, JS lets anything starting with a digit parse to a number.
 105    */
 106-  static canCoerceToNumber(value: any) : boolean {
 107+  public static canCoerceToNumber(value: any) : boolean {
 108     if (typeof value === "number" || typeof value === "boolean") {
 109       return true;
 110     } else if (typeof value === "string") {
 111@@ -460,7 +467,7 @@ class TypeConverter {
 112    * @param input to attempt to coerce into a number
 113    * @returns {number} number representation of the input
 114    */
 115-  static firstValueAsNumber(input: any) : number {
 116+  public static firstValueAsNumber(input: any) : number {
 117     if (input instanceof Array) {
 118       if (input.length === 0) {
 119         throw new RefError("Reference does not exist.");
 120@@ -475,7 +482,7 @@ class TypeConverter {
 121    * @param input to attempt to coerce into a string
 122    * @returns {number} number representation of the input
 123    */
 124-  static firstValueAsString(input: any) : string {
 125+  public static firstValueAsString(input: any) : string {
 126     if (input instanceof Array) {
 127       if (input.length === 0) {
 128         throw new RefError("Reference does not exist.");
 129@@ -485,7 +492,13 @@ class TypeConverter {
 130     return TypeConverter.valueToString(input);
 131   }
 132 
 133-  static firstValue(input: any) : any {
 134+
 135+  /**
 136+   * Returns the first value that is not of the type array. Will throw RefError if any empty arrays are passed in.
 137+   * @param input to retrieve first value of
 138+   * @returns {any} any non-array value.
 139+   */
 140+  public static firstValue(input: any) : any {
 141     if (input instanceof Array) {
 142       if (input.length === 0) {
 143         throw new RefError("Reference does not exist.");
 144@@ -500,7 +513,7 @@ class TypeConverter {
 145    * @param input to attempt to coerce into a string
 146    * @returns {number} number representation of the input
 147    */
 148-  static firstValueAsBoolean(input: any): boolean {
 149+  public static firstValueAsBoolean(input: any): boolean {
 150     if (input instanceof Array) {
 151       if (input.length === 0) {
 152         throw new RefError("Reference does not exist.");
 153@@ -516,7 +529,7 @@ class TypeConverter {
 154    * @param coerceBoolean should a boolean be converted
 155    * @returns {number} representing a date
 156    */
 157-  static firstValueAsDateNumber(input: any, coerceBoolean?: boolean) : number {
 158+  public static firstValueAsDateNumber(input: any, coerceBoolean?: boolean) : number {
 159     if (input instanceof Array) {
 160       if (input.length === 0) {
 161         throw new RefError("Reference does not exist.");
 162@@ -526,7 +539,12 @@ class TypeConverter {
 163     return TypeConverter.valueToDateNumber(input, coerceBoolean);
 164   }
 165 
 166-  static firstValueAsTimestampNumber(input : any) : number {
 167+  /**
 168+   * Takes the input type and will throw a REF_ERROR or coerce it into a time number
 169+   * @param input input to attempt to coerce to a time number
 170+   * @returns {number} representing time of day
 171+   */
 172+  public static firstValueAsTimestampNumber(input : any) : number {
 173     if (input instanceof Array) {
 174       if (input.length === 0) {
 175         throw new RefError("Reference does not exist.");
 176@@ -542,7 +560,7 @@ class TypeConverter {
 177    * @param coerceBoolean should a boolean be converted
 178    * @returns {number} date
 179    */
 180-  static valueToDateNumber(value: any, coerceBoolean?: boolean) : number {
 181+  public static valueToDateNumber(value: any, coerceBoolean?: boolean) : number {
 182     if (typeof value === "number") {
 183       return value;
 184     } else if (typeof value === "string") {
 185@@ -567,7 +585,7 @@ class TypeConverter {
 186    * @param m to convert
 187    * @returns {number} date
 188    */
 189-  static momentToNumber(m : moment.Moment) : number {
 190+  public static momentToNumber(m : moment.Moment) : number {
 191     return m.diff(this.ORIGIN_MOMENT, "seconds") / this.SECONDS_IN_DAY;
 192   }
 193 
 194@@ -576,7 +594,7 @@ class TypeConverter {
 195    * @param m to convert
 196    * @returns {number} date
 197    */
 198-  static momentToDayNumber(m : moment.Moment) : number {
 199+  public static momentToDayNumber(m : moment.Moment) : number {
 200     return Math.floor(TypeConverter.momentToNumber(m));
 201   }
 202 
 203@@ -585,7 +603,7 @@ class TypeConverter {
 204    * @param n to convert
 205    * @returns {Moment} date
 206    */
 207-  static numberToMoment(n : number) : moment.Moment {
 208+  public static numberToMoment(n : number) : moment.Moment {
 209     return moment.utc(TypeConverter.ORIGIN_MOMENT).add(n, "days");
 210   }
 211 
 212@@ -596,7 +614,7 @@ class TypeConverter {
 213    * @param seconds
 214    * @returns {number} representing time of day between 0 and 1, exclusive on end.
 215    */
 216-  static unitsToTimeNumber(hours: number, minutes: number, seconds: number): number {
 217+  public static unitsToTimeNumber(hours: number, minutes: number, seconds: number): number {
 218     var v = (((hours % 24) * 60 * 60) + ((minutes) * 60) + (seconds)) / 86400;
 219     return v % 1;
 220   }
 221diff --git a/tests/Formulas/DateFormulasTest.ts b/tests/Formulas/DateFormulasTest.ts
 222index a6c49ba..b6e84e5 100644
 223--- a/tests/Formulas/DateFormulasTest.ts
 224+++ b/tests/Formulas/DateFormulasTest.ts
 225@@ -1407,272 +1407,12 @@ test("DATE", function(){
 226 test("DATEVALUE", function(){
 227   assertEquals(DATEVALUE("6/24/92"), 33779);
 228   assertEquals(DATEVALUE(["6/24/92", false]), 33779);
 229-  catchAndAssertEquals(function() {
 230-    DATEVALUE("6/24/92", 10);
 231-  }, ERRORS.NA_ERROR);
 232-  catchAndAssertEquals(function() {
 233-    DATEVALUE();
 234-  }, ERRORS.NA_ERROR);
 235-  catchAndAssertEquals(function() {
 236-    DATEVALUE(false);
 237-  }, ERRORS.VALUE_ERROR);
 238-  // MONTHDIG_DAY_YEAR, MM(fd)DD(fd)YYYY ===============================================================================
 239-  assertEquals(DATEVALUE("6/24/92"), 33779);
 240-  assertEquals(DATEVALUE("6/24/1992"), 33779);
 241-  assertEquals(DATEVALUE("06/24/1992"), 33779);
 242-  assertEquals(DATEVALUE("1/01/1999"), 36161);
 243-  assertEquals(DATEVALUE("1/01/99"), 36161);
 244-  assertEquals(DATEVALUE("1/01/2222"), 117610);
 245-  assertEquals(DATEVALUE("9/02/1902"), 976);
 246-  assertEquals(DATEVALUE("9/2/1902"), 976);
 247-  assertEquals(DATEVALUE("11/3/4243"), 856071);
 248-  assertEquals(DATEVALUE("  04/19/1992  "), 33713);
 249-  assertEquals(DATEVALUE("5/20/1992"), 33744);
 250-  assertEquals(DATEVALUE("6/21/1992"), 33776);
 251-  assertEquals(DATEVALUE("9/29/1992"), 33876);
 252-  assertEquals(DATEVALUE("1/24/1992"), 33627);
 253-  assertEquals(DATEVALUE("12/21/1992"), 33959);
 254-  assertEquals(DATEVALUE("01/31/1992"), 33634);
 255-  assertEquals(DATEVALUE("1/13/1992"), 33616);
 256-  assertEquals(DATEVALUE("2/29/2004"), 38046);
 257-  assertEquals(DATEVALUE("2/28/2004"), 38045);
 258-  assertEquals(DATEVALUE("2/28/004"), 38045);
 259-  assertEquals(DATEVALUE("2/28/04"), 38045);
 260-  assertEquals(DATEVALUE("2/28/4"), 38045);
 261-  assertEquals(DATEVALUE("1/13/1999"), 36173);
 262-  assertEquals(DATEVALUE("01/13/1999"), 36173);
 263-  assertEquals(DATEVALUE("01/13/0999"), -329069);
 264-  assertEquals(DATEVALUE("01/13/1200"), -255656);
 265-  assertEquals(DATEVALUE("01/13/0029"), 47131);
 266-  assertEquals(DATEVALUE("01/13/0030"), 10971);
 267-  assertEquals(DATEVALUE("01/13/0044"), 16084);
 268-  assertEquals(DATEVALUE("01/13/0050"), 18276);
 269-  assertEquals(DATEVALUE("01/13/0097"), 35443);
 270-  assertEquals(DATEVALUE("01/13/0099"), 36173);
 271-  assertEquals(DATEVALUE("01/13/0000"), 36538);
 272-  assertEquals(DATEVALUE("01/13/0101"), -657057);
 273-  assertEquals(DATEVALUE("01/13/0100"), -657422);
 274-  assertEquals(DATEVALUE("12/31/100"), -657070);
 275-  assertEquals(DATEVALUE("11/10/122"), -649086);
 276-  assertEquals(DATEVALUE("1/22/2222"), 117631);
 277-  assertEquals(DATEVALUE("1/22/222"), -612854);
 278-  // delimiter tests
 279-  assertEquals(DATEVALUE("6-24-92"), 33779);
 280-  assertEquals(DATEVALUE("6/24/92"), 33779);
 281-  assertEquals(DATEVALUE("6 24 92"), 33779);
 282-  assertEquals(DATEVALUE("6.24.92"), 33779);
 283-  assertEquals(DATEVALUE("6 . 24 . 92"), 33779);
 284-  assertEquals(DATEVALUE("6 / 24 / 92"), 33779);
 285-  assertEquals(DATEVALUE("6, 24, 92"), 33779);
 286-  // flex delimiter should not allow a comma without a space after it.
 287-  catchAndAssertEquals(function() {
 288-    DATEVALUE("Sunday,6/24/92");
 289-  }, ERRORS.VALUE_ERROR);
 290-  // Leap day on non-leap years
 291-  catchAndAssertEquals(function() {
 292-    DATEVALUE("2/29/2005");
 293-  }, ERRORS.VALUE_ERROR);
 294-  catchAndAssertEquals(function() {
 295-    DATEVALUE("2/29/2001");
 296-  }, ERRORS.VALUE_ERROR);
 297-  // Out of range day for any month
 298-  catchAndAssertEquals(function() {
 299-    DATEVALUE("1/44/2005");
 300-  }, ERRORS.VALUE_ERROR);
 301-  // timestamp test
 302   assertEquals(DATEVALUE("6-24-92 10am"), 33779);
 303-  assertEquals(DATEVALUE("6-24-92 10:10"), 33779);
 304-  assertEquals(DATEVALUE("6-24-92 10:10am"), 33779);
 305-  assertEquals(DATEVALUE("6-24-92 10:10:10"), 33779);
 306-  assertEquals(DATEVALUE("6-24-92 10:10:10am"), 33779);
 307-  assertEquals(DATEVALUE("6-24-92  10  am"), 33779);
 308-  assertEquals(DATEVALUE("6-24-92 10: 10 "), 33779);
 309-  assertEquals(DATEVALUE("6-24-92 10: 10 pm"), 33779);
 310-  assertEquals(DATEVALUE("6-24-92 10: 10: 10"), 33779);
 311-  assertEquals(DATEVALUE("6-24-92  10: 10: 10    am  "), 33779);
 312   assertEquals(DATEVALUE("1992/6/24 00:00"), 33779);
 313-  assertEquals(DATEVALUE("1992/6/24 0:00"), 33779);
 314-  assertEquals(DATEVALUE("1992/6/24 10:10"), 33779);
 315-  assertEquals(DATEVALUE("1992/6/24 16:22"), 33779);
 316-  assertEquals(DATEVALUE("1992/6/24 25:10"), 33780);
 317-  assertEquals(DATEVALUE("1992/6/24 23:60"), 33780);
 318-  assertEquals(DATEVALUE("1992/6/24 24:00"), 33780);
 319-  assertEquals(DATEVALUE("1992/6/24 23:59"), 33779);
 320-  assertEquals(DATEVALUE("1999/1/13 10:11111111"), 43889);
 321-  assertEquals(DATEVALUE("1999/1/13 25000:22"), 37214);
 322-  assertEquals(DATEVALUE("1999/1/13 25000:    22"), 37214);
 323-  assertEquals(DATEVALUE("1992/6/24 00:00am"), 33779);
 324-  assertEquals(DATEVALUE("1992/06/24 01:44am "), 33779);
 325-  assertEquals(DATEVALUE("1999/1/01 02:59pm"), 36161);
 326-  assertEquals(DATEVALUE("2222/1/01 03:33pm"), 117610);
 327-  assertEquals(DATEVALUE("1902/9/02 12:33pm"), 976);
 328-  assertEquals(DATEVALUE("1902/9/2 12:33pm"), 976);
 329-  assertEquals(DATEVALUE("4243/11/3 12:33pm"), 856071);
 330-  assertEquals(DATEVALUE("  1992/04/19   12:  33pm   "), 33713);
 331-  assertEquals(DATEVALUE("1992/5/20 01:33am"), 33744);
 332-  assertEquals(DATEVALUE("1992/6/21  3:33pm"), 33776);
 333-  assertEquals(DATEVALUE("1992/9/29 3:33pm"), 33876);
 334-  assertEquals(DATEVALUE("1992/1/24 3:33pm"), 33627);
 335-  assertEquals(DATEVALUE("1992/12/21 3:33pm"), 33959);
 336-  assertEquals(DATEVALUE("1992/01/31 3:33pm"), 33634);
 337-  assertEquals(DATEVALUE("1992/1/13 3:33pm"), 33616);
 338-  assertEquals(DATEVALUE("2004/2/29 3:33pm"), 38046);
 339-  assertEquals(DATEVALUE("2004/2/28  3:33pm "), 38045);
 340-  assertEquals(DATEVALUE("1999/1/13 3:33pm"), 36173);
 341-  assertEquals(DATEVALUE("1999/01/13 3:33pm"), 36173);
 342-  assertEquals(DATEVALUE("0999/01/13 3:33pm"), -329069);
 343-  assertEquals(DATEVALUE("1200/01/13 3:33pm"), -255656);
 344-  assertEquals(DATEVALUE("0029/01/13 3:33pm"), 47131);
 345-  assertEquals(DATEVALUE("0030/01/13 3:33pm"), 10971);
 346-  assertEquals(DATEVALUE("0044/01/13 3:33pm"), 16084);
 347-  assertEquals(DATEVALUE("0050/01/13 3:33pm"), 18276);
 348-  assertEquals(DATEVALUE("0097/01/13 00:33pm"), 35443);
 349-  assertEquals(DATEVALUE("0099/01/13 3:33pm"), 36173);
 350-  assertEquals(DATEVALUE("0000/01/13 3:33pm"), 36538);
 351-  assertEquals(DATEVALUE("0101/01/13 3:33pm"), -657057);
 352-  assertEquals(DATEVALUE("0100/01/13 3:33pm"), -657422);
 353-  assertEquals(DATEVALUE("100/12/31 3:33pm"), -657070);
 354-  assertEquals(DATEVALUE("122/11/10 3:33pm"), -649086);
 355-  assertEquals(DATEVALUE("2222/1/22 3:33pm"), 117631);
 356-  assertEquals(DATEVALUE("222/1/22 3:33pm"), -612854);
 357-  assertEquals(DATEVALUE("1992/1/13 6:22222222am"), 49048); // overload minutes
 358-  assertEquals(DATEVALUE("1992/1/13 12:720pm"), 33617); // overload minutes
 359-  assertEquals(DATEVALUE("1992/1/13 00:720pm"), 33617); // overload minutes
 360-  assertEquals(DATEVALUE("1992/1/13 12:719pm"), 33616); // overload minutes
 361-  assertEquals(DATEVALUE("1992/1/13 00:720am"), 33616); // overload minutes
 362-  assertEquals(DATEVALUE("1992/1/13 00:01pm"), 33616); // overload minutes
 363-  assertEquals(DATEVALUE("1992/1/13 12:66669pm"), 33662); // overload minutes
 364-  assertEquals(DATEVALUE("1992/1/13 12:66669am"), 33662); // overload minutes
 365-  assertEquals(DATEVALUE("1992/1/13 12:66249pm"), 33662); // overload minutes
 366-  assertEquals(DATEVALUE("1992/1/13 12:66249am"), 33662); // overload minutes
 367-  assertEquals(DATEVALUE("1992/1/13 12:666669am"), 34078); // overload minutes
 368-  assertEquals(DATEVALUE("1992/1/13 12:666669pm"), 34079); // overload minutes
 369-  assertEquals(DATEVALUE("1992/1/13 12:100000000am"), 103060); // overload minutes
 370-  assertEquals(DATEVALUE("1992/1/13 12:0912347287am"), 667190); // overload minutes
 371-  assertEquals(DATEVALUE("1992/1/13 12:00000912347287am"), 667190); // overload minutes
 372-  assertEquals(DATEVALUE("1992/1/13 12:1989198298am"), 1415003); // overload minutes
 373-  assertEquals(DATEVALUE("1992/6/24 0:0:0"), 33779);
 374-  assertEquals(DATEVALUE("1992/6/24 0000:0000:0000"), 33779);
 375-  assertEquals(DATEVALUE("0000/01/13 3:33:999999999"), 48112); // overload seconds
 376-  assertEquals(DATEVALUE("1992/1/13 6:22222222:0"), 49048); // overload minutes
 377-  assertEquals(DATEVALUE("1992/1/13 12:912347287:10"), 667191); // overload minutes
 378-  assertEquals(DATEVALUE("1992/1/13 12:100000000:10"), 103060); // overload minutes
 379-  assertEquals(DATEVALUE("1992/1/13 23:720:10"), 33617); // overload minutes
 380-  assertEquals(DATEVALUE("1992/1/13 23:719:60"), 33617); // overload minutes, seconds
 381-  assertEquals(DATEVALUE("1992/6/24 24:00:00"), 33780); // overload hours
 382-  assertEquals(DATEVALUE("1999/1/01 200000000:999999999:923231312"), 9074624); // overload hours, minutes, seconds
 383-  assertEquals(DATEVALUE("  1992/04/19   12:  33: 11  "), 33713);
 384-  assertEquals(DATEVALUE("0000/01/13 3:33:33"), 36538);
 385   assertEquals(DATEVALUE("4243/11/3 200000000:33:444"), 9189404);
 386-  assertEquals(DATEVALUE("1999/1/13 10:10:10pm"), 36173);
 387-  assertEquals(DATEVALUE("1992/6/24 0:0:0pm"), 33779);
 388-  assertEquals(DATEVALUE("1992/6/24 00:0000:0000pm"), 33779);
 389-  assertEquals(DATEVALUE("0000/01/13 3:33:999999999pm"), 48112); // overload seconds
 390-  assertEquals(DATEVALUE("1992/1/13 6:22222222:0pm"), 49048); // overload minutes
 391-  assertEquals(DATEVALUE("1992/1/13 12:912347287:10pm"), 667191); // overload minutes
 392-  assertEquals(DATEVALUE("1992/1/13 12:100000000:10pm"), 103060); // overload minutes
 393-  assertEquals(DATEVALUE("1992/6/24 00:00:00am"), 33779);
 394-  assertEquals(DATEVALUE("1992/06/24 01:44:00am "), 33779);
 395-  assertEquals(DATEVALUE("1999/1/01 02:59:00pm"), 36161);
 396-  assertEquals(DATEVALUE("2222/1/01 03:33:00pm"), 117610);
 397-  assertEquals(DATEVALUE("1902/9/02 12:33:00pm"), 976);
 398-  assertEquals(DATEVALUE("1902/9/2 12:33:00pm"), 976);
 399-  assertEquals(DATEVALUE("4243/11/3 12:33:00pm"), 856071);
 400-  assertEquals(DATEVALUE("  1992/04/19   12:  33:  00  pm   "), 33713);
 401-  assertEquals(DATEVALUE("1992/5/20 01:33:44am"), 33744);
 402-  assertEquals(DATEVALUE("1992/6/21  3:33:44pm"), 33776);
 403-  assertEquals(DATEVALUE("1992/9/29 3:33:44pm"), 33876);
 404-  assertEquals(DATEVALUE("1992/1/24 3:33:44pm"), 33627);
 405-  assertEquals(DATEVALUE("1992/12/21 3:33:44pm"), 33959);
 406-  assertEquals(DATEVALUE("1992/01/31 3:33:44pm"), 33634);
 407-  assertEquals(DATEVALUE("1992/1/13 3:33:44pm"), 33616);
 408-  assertEquals(DATEVALUE("2004/2/29 3:33:44pm"), 38046);
 409-  assertEquals(DATEVALUE("2004/2/28  3:33:44pm "), 38045);
 410-  assertEquals(DATEVALUE("1999/1/13 3:33:44pm"), 36173);
 411-  assertEquals(DATEVALUE("1999/01/13 3:33:44pm"), 36173);
 412-  assertEquals(DATEVALUE("0999/01/13 3:33:44pm"), -329069);
 413-  assertEquals(DATEVALUE("1200/01/13 3:33:44pm"), -255656);
 414-  assertEquals(DATEVALUE("0029/01/13 3:33:44pm"), 47131);
 415-  assertEquals(DATEVALUE("0030/01/13 3:33:44pm"), 10971);
 416-  assertEquals(DATEVALUE("0044/01/13 3:33:44pm"), 16084);
 417-  assertEquals(DATEVALUE("0050/01/13 3:33:44pm"), 18276);
 418-  assertEquals(DATEVALUE("0097/01/13 00:33:44pm"), 35443);
 419-  assertEquals(DATEVALUE("0099/01/13 3:33:44pm"), 36173);
 420-  assertEquals(DATEVALUE("0000/01/13 3:33:44pm"), 36538);
 421-  assertEquals(DATEVALUE("0101/01/13 3:33:44pm"), -657057);
 422-  assertEquals(DATEVALUE("0100/01/13 3:33:44pm"), -657422);
 423-  assertEquals(DATEVALUE("100/12/31 3:33:44pm"), -657070);
 424-  assertEquals(DATEVALUE("122/11/10 3:33:44pm"), -649086);
 425-  assertEquals(DATEVALUE("2222/1/22 3:33:44pm"), 117631);
 426-  assertEquals(DATEVALUE("222/1/22 3:33:44pm"), -612854);
 427   assertEquals(DATEVALUE("1992/1/13 6:22222222:44am"), 49048); // overload minutes
 428-  assertEquals(DATEVALUE("1992/1/13 12:720:00pm"), 33617); // overload minutes
 429-  assertEquals(DATEVALUE("1992/1/13 00:720:00pm"), 33617); // overload minutes
 430-  assertEquals(DATEVALUE("1992/1/13 12:719:00pm"), 33616); // overload minutes
 431-  assertEquals(DATEVALUE("1992/1/13 00:720:00am"), 33616); // overload minutes
 432-  assertEquals(DATEVALUE("1992/1/13 12:719:60pm"), 33617); // overload minutes
 433-  assertEquals(DATEVALUE("1992/1/13 00:720:00am"), 33616); // overload minutes
 434-  assertEquals(DATEVALUE("1992/1/13 00:01:00pm"), 33616); // overload minutes
 435-  assertEquals(DATEVALUE("1992/1/13 12:66669:00pm"), 33662); // overload minutes
 436-  assertEquals(DATEVALUE("1992/1/13 12:66669:00am"), 33662); // overload minutes
 437-  assertEquals(DATEVALUE("1992/1/13 12:66249:00pm"), 33662); // overload minutes
 438-  assertEquals(DATEVALUE("1992/1/13 12:66249:00am"), 33662); // overload minutes
 439-  assertEquals(DATEVALUE("1992/1/13 12:666669:00am"), 34078); // overload minutes
 440-  assertEquals(DATEVALUE("1992/1/13 12:666669:00pm"), 34079); // overload minutes
 441-  assertEquals(DATEVALUE("1992/1/13 12:100000000:00am"), 103060); // overload minutes
 442-  assertEquals(DATEVALUE("1992/1/13 12:912347287:00am"), 667190); // overload minutes
 443-  // YEAR_MONTHDIG_DAY, YYYY(fd)MM(fd)DD ===============================================================================
 444   assertEquals(DATEVALUE("1992/6/24"), 33779);
 445-  assertEquals(DATEVALUE("1992/06/24"), 33779);
 446-  assertEquals(DATEVALUE("1999/1/01"), 36161);
 447-  assertEquals(DATEVALUE("2222/1/01"), 117610);
 448-  assertEquals(DATEVALUE("1902/9/02"), 976);
 449-  assertEquals(DATEVALUE("1902/9/2"), 976);
 450-  assertEquals(DATEVALUE("4243/11/3"), 856071);
 451-  assertEquals(DATEVALUE("  1992/04/19  "), 33713);
 452-  assertEquals(DATEVALUE("  1992 /  04/ 19  "), 33713);
 453-  assertEquals(DATEVALUE("1992/5/20"), 33744);
 454-  assertEquals(DATEVALUE("1992/6/21"), 33776);
 455-  assertEquals(DATEVALUE("1992/9/29"), 33876);
 456-  assertEquals(DATEVALUE("1992/1/24"), 33627);
 457-  assertEquals(DATEVALUE("1992/12/21"), 33959);
 458-  assertEquals(DATEVALUE("1992/01/31"), 33634);
 459-  assertEquals(DATEVALUE("1992/1/13"), 33616);
 460-  assertEquals(DATEVALUE("2004/2/29"), 38046);
 461-  assertEquals(DATEVALUE("2004/2/28"), 38045);
 462-  assertEquals(DATEVALUE("1999/1/13"), 36173);
 463-  assertEquals(DATEVALUE("1999/01/13"), 36173);
 464-  assertEquals(DATEVALUE("0999/01/13"), -329069);
 465-  assertEquals(DATEVALUE("1200/01/13"), -255656);
 466-  assertEquals(DATEVALUE("0029/01/13"), 47131);
 467-  assertEquals(DATEVALUE("0030/01/13"), 10971);
 468-  assertEquals(DATEVALUE("0044/01/13"), 16084);
 469-  assertEquals(DATEVALUE("0050/01/13"), 18276);
 470-  assertEquals(DATEVALUE("0097/01/13"), 35443);
 471-  assertEquals(DATEVALUE("0099/01/13"), 36173);
 472-  assertEquals(DATEVALUE("0000/01/13"), 36538);
 473-  assertEquals(DATEVALUE("0101/01/13"), -657057);
 474-  assertEquals(DATEVALUE("0100/01/13"), -657422);
 475-  assertEquals(DATEVALUE("100/12/31"), -657070);
 476-  assertEquals(DATEVALUE("122/11/10"), -649086);
 477-  assertEquals(DATEVALUE("2222/1/22"), 117631);
 478-  assertEquals(DATEVALUE("222/1/22"), -612854);
 479   assertEquals(DATEVALUE("Sunday 1992/6/24"), 33779);
 480-  assertEquals(DATEVALUE("Monday 1992/6/24"), 33779);
 481-  assertEquals(DATEVALUE("Tuesday 1992/6/24"), 33779);
 482-  assertEquals(DATEVALUE("Wednesday 1992/6/24"), 33779);
 483-  assertEquals(DATEVALUE("Thursday 1992/6/24"), 33779);
 484-  assertEquals(DATEVALUE("Friday 1992/6/24"), 33779);
 485-  assertEquals(DATEVALUE("Saturday 1992/6/24"), 33779);
 486-  assertEquals(DATEVALUE("Sun 1992/6/24"), 33779);
 487-  assertEquals(DATEVALUE("Mon 1992/6/24"), 33779);
 488-  assertEquals(DATEVALUE("Tue 1992/6/24"), 33779);
 489-  assertEquals(DATEVALUE("Wed 1992/6/24"), 33779);
 490-  assertEquals(DATEVALUE("Thu 1992/6/24"), 33779);
 491-  assertEquals(DATEVALUE("Fri 1992/6/24"), 33779);
 492-  assertEquals(DATEVALUE("Sat 1992/6/24"), 33779);
 493-  assertEquals(DATEVALUE("Sunday, 1992/6/24"), 33779);
 494-  // delimiter tests
 495   assertEquals(DATEVALUE("1992-6-24"), 33779);
 496   assertEquals(DATEVALUE("1992/6/24"), 33779);
 497   assertEquals(DATEVALUE("1992 6 24"), 33779);
 498@@ -1680,360 +1420,55 @@ test("DATEVALUE", function(){
 499   assertEquals(DATEVALUE("1992 . 6 . 24"), 33779);
 500   assertEquals(DATEVALUE("1992 / 6 / 24"), 33779);
 501   assertEquals(DATEVALUE("1992, 6, 24"), 33779);
 502-  // flex delimiter should not allow a comma without a space after it.
 503-  catchAndAssertEquals(function() {
 504-    DATEVALUE("Sunday,1992/6/24");
 505-  }, ERRORS.VALUE_ERROR);
 506-  // Leap day on non-leap years
 507-  catchAndAssertEquals(function() {
 508-    DATEVALUE("2005/2/29");
 509-  }, ERRORS.VALUE_ERROR);
 510-  catchAndAssertEquals(function() {
 511-    DATEVALUE("2001/2/29");
 512-  }, ERRORS.VALUE_ERROR);
 513-  // Out of range day for any month
 514-  catchAndAssertEquals(function() {
 515-    DATEVALUE("2005/1/44");
 516-  }, ERRORS.VALUE_ERROR);
 517-  // timestamp test
 518-  assertEquals(DATEVALUE("1992-6-24 10am"), 33779);
 519-  assertEquals(DATEVALUE("1992-6-24 10:10"), 33779);
 520-  assertEquals(DATEVALUE("1992-6-24 10:10am"), 33779);
 521-  assertEquals(DATEVALUE("1992-6-24 10:10:10"), 33779);
 522-  assertEquals(DATEVALUE("1992-6-24 10:10:10am"), 33779);
 523-  assertEquals(DATEVALUE("1992-6-24  10  am"), 33779);
 524-  assertEquals(DATEVALUE("1992-6-24 10: 10 "), 33779);
 525-  assertEquals(DATEVALUE("1992-6-24 10: 10 pm"), 33779);
 526-  assertEquals(DATEVALUE("1992-6-24 10: 10: 10"), 33779);
 527-  assertEquals(DATEVALUE("1992-6-24  10: 10: 10    am   "), 33779);
 528   assertEquals(DATEVALUE("1992/6/24 00am"), 33779);
 529-  assertEquals(DATEVALUE("1992/06/24 01am "), 33779);
 530-  assertEquals(DATEVALUE("1999/1/01 02pm"), 36161);
 531-  assertEquals(DATEVALUE("2222/1/01 03pm"), 117610);
 532-  assertEquals(DATEVALUE("1902/9/02 12pm"), 976);
 533-  assertEquals(DATEVALUE("1902/9/2 12pm"), 976);
 534-  assertEquals(DATEVALUE("4243/11/3 12pm   "), 856071);
 535-  assertEquals(DATEVALUE("  1992/04/19   12pm   "), 33713);
 536   assertEquals(DATEVALUE("1992/5/20 01am"), 33744);
 537-  assertEquals(DATEVALUE("1992/6/21  3pm"), 33776);
 538-  assertEquals(DATEVALUE("1992/9/29 3pm"), 33876);
 539-  assertEquals(DATEVALUE("1992/1/24 3pm"), 33627);
 540-  assertEquals(DATEVALUE("1992/12/21 3pm"), 33959);
 541-  assertEquals(DATEVALUE("1992/01/31 3pm"), 33634);
 542-  assertEquals(DATEVALUE("1992/1/13 3pm"), 33616);
 543-  assertEquals(DATEVALUE("2004/2/29 3pm"), 38046);
 544-  assertEquals(DATEVALUE("2004/2/28  3pm "), 38045);
 545-  assertEquals(DATEVALUE("1999/1/13 3pm"), 36173);
 546-  assertEquals(DATEVALUE("1999/01/13 3pm"), 36173);
 547-  assertEquals(DATEVALUE("0999/01/13 3pm"), -329069);
 548-  assertEquals(DATEVALUE("1200/01/13 3pm"), -255656);
 549-  assertEquals(DATEVALUE("0029/01/13 3pm"), 47131);
 550-  assertEquals(DATEVALUE("0030/01/13 3pm"), 10971);
 551-  assertEquals(DATEVALUE("0044/01/13 3pm"), 16084);
 552-  assertEquals(DATEVALUE("0050/01/13 3pm"), 18276);
 553-  assertEquals(DATEVALUE("0097/01/13 00pm"), 35443);
 554-  assertEquals(DATEVALUE("0099/01/13 3pm"), 36173);
 555-  assertEquals(DATEVALUE("0000/01/13 3pm"), 36538);
 556-  assertEquals(DATEVALUE("0101/01/13 3pm"), -657057);
 557-  assertEquals(DATEVALUE("0100/01/13 3pm"), -657422);
 558-  assertEquals(DATEVALUE("100/12/31 3pm"), -657070);
 559-  assertEquals(DATEVALUE("122/11/10 3pm"), -649086);
 560-  assertEquals(DATEVALUE("2222/1/22 3pm"), 117631);
 561-  assertEquals(DATEVALUE("222/1/22 3pm"), -612854);
 562-  catchAndAssertEquals(function() {
 563-    DATEVALUE("2005/2/29 000pm");// Too many digits
 564-  }, ERRORS.VALUE_ERROR);
 565-  catchAndAssertEquals(function() {
 566-    DATEVALUE("2001/2/2 13pm");// Hour out of range
 567-  }, ERRORS.VALUE_ERROR);
 568-  // DAY_MONTHNAME_YEAR, DD(fd)Month(fd)YYYY ===========================================================================
 569   assertEquals(DATEVALUE("Sun 09 Feb 2017"), 42775);
 570-  assertEquals(DATEVALUE("Sun 9 Feb 2017"), 42775);
 571-  assertEquals(DATEVALUE("Mon 09 Feb 2017"), 42775);
 572-  assertEquals(DATEVALUE("Thursday 09 Feb 2017"), 42775);
 573-  assertEquals(DATEVALUE("Thursday 09 February 2017"), 42775);
 574-  assertEquals(DATEVALUE("Sun 01 September 20"), 44075);
 575-  assertEquals(DATEVALUE("Sun, 09, Feb, 2017"), 42775);
 576-  assertEquals(DATEVALUE("20 May 1992"), 33744);
 577-  assertEquals(DATEVALUE("31 December 100"), -657070);
 578-  assertEquals(DATEVALUE("13 January 0030"), 10971);
 579-  assertEquals(DATEVALUE("13 January 1200"), -255656);
 580-  assertEquals(DATEVALUE("22 January 2222"), 117631);
 581-  assertEquals(DATEVALUE("3 November 4243"), 856071);
 582-  assertEquals(DATEVALUE("13 November 0999"), -328765);
 583-  assertEquals(DATEVALUE("13 November 1200"), -255351);
 584-  assertEquals(DATEVALUE("13 January 0029"), 47131);
 585-  assertEquals(DATEVALUE("13 January 0030"), 10971);
 586-  assertEquals(DATEVALUE("13 January 0044"), 16084);
 587-  assertEquals(DATEVALUE("13 January 0050"), 18276);
 588-  assertEquals(DATEVALUE("13 January 0097"), 35443);
 589-  assertEquals(DATEVALUE("13 January 0099"), 36173);
 590-  assertEquals(DATEVALUE("13 January 0000"), 36538);
 591-  assertEquals(DATEVALUE("13 January 0101"), -657057);
 592-  assertEquals(DATEVALUE("13 January 0100"), -657422);
 593   assertEquals(DATEVALUE("01 Jan 2017"), 42736);
 594-  assertEquals(DATEVALUE("01 Feb 2017"), 42767);
 595-  assertEquals(DATEVALUE("01 Mar 2017"), 42795);
 596-  assertEquals(DATEVALUE("01 Apr 2017"), 42826);
 597-  assertEquals(DATEVALUE("01 May 2017"), 42856);
 598-  assertEquals(DATEVALUE("01 Jun 2017"), 42887);
 599-  assertEquals(DATEVALUE("01 Jul 2017"), 42917);
 600-  assertEquals(DATEVALUE("01 Aug 2017"), 42948);
 601-  assertEquals(DATEVALUE("01 Sep 2017"), 42979);
 602-  assertEquals(DATEVALUE("01 Oct 2017"), 43009);
 603-  assertEquals(DATEVALUE("01 Nov 2017"), 43040);
 604-  assertEquals(DATEVALUE(" 1 Dec 2017"), 43070);
 605-  assertEquals(DATEVALUE("20 Jan 2015"), 42024);
 606-  assertEquals(DATEVALUE("20 Feb 2015"), 42055);
 607-  assertEquals(DATEVALUE("20 Mar 2015"), 42083);
 608-  assertEquals(DATEVALUE("20 Apr 2015"), 42114);
 609-  assertEquals(DATEVALUE("20 May 2015"), 42144);
 610-  assertEquals(DATEVALUE("20 Jun 2015"), 42175);
 611-  assertEquals(DATEVALUE("20 Jul 2015"), 42205);
 612-  assertEquals(DATEVALUE("20 Aug 2015"), 42236);
 613-  assertEquals(DATEVALUE("20 Sep 2015"), 42267);
 614-  assertEquals(DATEVALUE("20 Oct 2015"), 42297);
 615-  assertEquals(DATEVALUE("20 Nov 2015"), 42328);
 616-  assertEquals(DATEVALUE("20 Dec 2015"), 42358);
 617-  assertEquals(DATEVALUE("29 Feb 2004"), 38046); // leap year, 29th ok
 618-  catchAndAssertEquals(function() {
 619-    DATEVALUE("29 Feb 2001");// not leap year, 29th not ok
 620-  }, ERRORS.VALUE_ERROR);
 621-  catchAndAssertEquals(function() {
 622-    DATEVALUE("32 June 2001");// overload numbers not ok
 623-  }, ERRORS.VALUE_ERROR);
 624-  // delimiter tests
 625-  assertEquals(DATEVALUE("Sun, 09, Feb, 2017"), 42775);
 626-  assertEquals(DATEVALUE("Sun, 09/Feb/2017"), 42775);
 627-  assertEquals(DATEVALUE("09/Feb/2017"), 42775);
 628-  assertEquals(DATEVALUE("09-Feb-2017"), 42775);
 629-  assertEquals(DATEVALUE("09.Feb.2017"), 42775);
 630-  assertEquals(DATEVALUE("09 Feb/2017"), 42775);
 631-  assertEquals(DATEVALUE("09 . Feb . 2017"), 42775);
 632-  // If the delimiters don't match the first one should be a space.
 633-  catchAndAssertEquals(function() {
 634-    DATEVALUE("09.Feb/2017");
 635-  }, ERRORS.VALUE_ERROR);
 636-  // Comma delimiters should be followed by spaces.
 637-  catchAndAssertEquals(function() {
 638-    DATEVALUE("09,Feb,2017");
 639-  }, ERRORS.VALUE_ERROR);
 640-  // timestamp tests
 641   assertEquals(DATEVALUE("24/June/1992 10am"), 33779);
 642   assertEquals(DATEVALUE("24/June/1992 10:10"), 33779);
 643   assertEquals(DATEVALUE("24/June/1992 10:10am"), 33779);
 644   assertEquals(DATEVALUE("24/June/1992 10:10:10"), 33779);
 645   assertEquals(DATEVALUE("24/June/1992 10:10:10am"), 33779);
 646-  assertEquals(DATEVALUE("24/June/1992  10  am"), 33779);
 647-  assertEquals(DATEVALUE("24/June/1992 10: 10 "), 33779);
 648-  assertEquals(DATEVALUE("24/June/1992 10: 10 pm"), 33779);
 649-  assertEquals(DATEVALUE("24/June/1992 10: 10: 10"), 33779);
 650-  assertEquals(DATEVALUE("24/June/1992  10: 10: 10    am   "), 33779);
 651-  // MONTHNAME_DAY_YEAR, Month(fd)DD(fd)YYYY, 'Aug 19 2020' ============================================================
 652   assertEquals(DATEVALUE("Sun Feb 09 2017"), 42775);
 653-  assertEquals(DATEVALUE("Sun Feb 9 2017"), 42775);
 654-  assertEquals(DATEVALUE("Mon Feb 09 2017"), 42775);
 655-  assertEquals(DATEVALUE("Thursday Feb 09 2017"), 42775);
 656-  assertEquals(DATEVALUE("Thursday February 09 2017"), 42775);
 657-  assertEquals(DATEVALUE("Sun September 01 20"), 44075);
 658-  assertEquals(DATEVALUE("Sun, Feb, 09, 2017"), 42775);
 659-  assertEquals(DATEVALUE("May 20 1992"), 33744);
 660-  assertEquals(DATEVALUE("December 31 100"), -657070);
 661-  assertEquals(DATEVALUE("January 13 0030"), 10971);
 662-  assertEquals(DATEVALUE("January 13 1200"), -255656);
 663-  assertEquals(DATEVALUE("January 22 2222"), 117631);
 664-  assertEquals(DATEVALUE("November 3 4243"), 856071);
 665-  assertEquals(DATEVALUE("Feb 29 2004"), 38046); // leap year, 29th ok
 666-  catchAndAssertEquals(function() {
 667-    DATEVALUE("Feb 29 2001");// not leap year, 29th not ok
 668-  }, ERRORS.VALUE_ERROR);
 669-  catchAndAssertEquals(function() {
 670-    DATEVALUE("June 32 2001");// overload numbers not ok
 671-  }, ERRORS.VALUE_ERROR);
 672-  // YEAR_MONTHDIG, YYYY(fd)MM, '1992/06' ==============================================================================
 673-  assertEquals(DATEVALUE("2017/01"), 42736);
 674-  assertEquals(DATEVALUE("2017/02"), 42767);
 675-  assertEquals(DATEVALUE("2017/03"), 42795);
 676-  assertEquals(DATEVALUE("2017/04"), 42826);
 677-  assertEquals(DATEVALUE("2017/05"), 42856);
 678-  assertEquals(DATEVALUE("2017/06"), 42887);
 679-  assertEquals(DATEVALUE("2017/07"), 42917);
 680-  assertEquals(DATEVALUE("2017/08"), 42948);
 681-  assertEquals(DATEVALUE("2017/09"), 42979);
 682-  assertEquals(DATEVALUE("2017/10"), 43009);
 683-  assertEquals(DATEVALUE("2017/11"), 43040);
 684-  assertEquals(DATEVALUE("2017/12"), 43070);
 685-  assertEquals(DATEVALUE("2017/01"), 42736);
 686-  // delimiter tests
 687-  assertEquals(DATEVALUE("Thursday 2017/01"), 42736);
 688-  assertEquals(DATEVALUE("Thursday, 2017/01"), 42736);
 689   assertEquals(DATEVALUE("2017/01"), 42736);
 690-  assertEquals(DATEVALUE("2017-01"), 42736);
 691-  assertEquals(DATEVALUE("2017. 01"), 42736);
 692-  assertEquals(DATEVALUE("2017 01"), 42736);
 693-  assertEquals(DATEVALUE("2017, 01"), 42736);
 694-  // Comma and period delimiters should be followed by spaces.
 695-  catchAndAssertEquals(function() {
 696-    DATEVALUE("2017,01");
 697-  }, ERRORS.VALUE_ERROR);
 698-  catchAndAssertEquals(function() {
 699-    DATEVALUE("2017.01");
 700-  }, ERRORS.VALUE_ERROR);
 701-  // timestamp test
 702   assertEquals(DATEVALUE("2017-01 10am"), 42736);
 703-  assertEquals(DATEVALUE("2017-01 10:10"), 42736);
 704-  assertEquals(DATEVALUE("2017-01 10:10am"), 42736);
 705-  assertEquals(DATEVALUE("2017-01 10:10:10"), 42736);
 706-  assertEquals(DATEVALUE("2017-01 10:10:10am"), 42736);
 707-  assertEquals(DATEVALUE("2017-01  10  am"), 42736);
 708-  assertEquals(DATEVALUE("2017-01 10: 10 "), 42736);
 709-  assertEquals(DATEVALUE("2017-01 10: 10 pm"), 42736);
 710-  assertEquals(DATEVALUE("2017-01 10: 10: 10"), 42736);
 711-  assertEquals(DATEVALUE("2017-01  10: 10: 10    am   "), 42736);
 712-  // MONTHDIG_YEAR, MM(fd)YYYY, '06/1992' ================================================================================
 713   assertEquals(DATEVALUE("01/2017"), 42736);
 714-  assertEquals(DATEVALUE("02/2017"), 42767);
 715-  assertEquals(DATEVALUE("03/2017"), 42795);
 716-  assertEquals(DATEVALUE("04/2017"), 42826);
 717-  assertEquals(DATEVALUE("05/2017"), 42856);
 718-  assertEquals(DATEVALUE("06/2017"), 42887);
 719-  assertEquals(DATEVALUE("07/2017"), 42917);
 720-  assertEquals(DATEVALUE("08/2017"), 42948);
 721-  assertEquals(DATEVALUE("09/2017"), 42979);
 722-  assertEquals(DATEVALUE("10/2017"), 43009);
 723-  assertEquals(DATEVALUE("11/2017"), 43040);
 724-  assertEquals(DATEVALUE("12/2017"), 43070);
 725-  // delimiter tests
 726-  assertEquals(DATEVALUE("Thursday 01/2017"), 42736);
 727-  assertEquals(DATEVALUE("Thursday, 01/2017"), 42736);
 728-  assertEquals(DATEVALUE("1/2017"), 42736);
 729-  assertEquals(DATEVALUE("01-2017"), 42736);
 730-  assertEquals(DATEVALUE("01. 2017"), 42736);
 731-  assertEquals(DATEVALUE("01, 2017"), 42736);
 732-  // Comma, period delimiters should be followed by spaces.
 733-  catchAndAssertEquals(function() {
 734-    DATEVALUE("01,2017");
 735-  }, ERRORS.VALUE_ERROR);
 736-  catchAndAssertEquals(function() {
 737-    DATEVALUE("01.2017");
 738-  }, ERRORS.VALUE_ERROR);
 739-  // 0 is not a month
 740-  catchAndAssertEquals(function() {
 741-    DATEVALUE("0/2017");
 742-  }, ERRORS.VALUE_ERROR);
 743-  // timestamp test
 744   assertEquals(DATEVALUE("01-2017 10am"), 42736);
 745-  assertEquals(DATEVALUE("01-2017 10:10"), 42736);
 746-  assertEquals(DATEVALUE("01-2017 10:10am"), 42736);
 747-  assertEquals(DATEVALUE("01-2017 10:10:10"), 42736);
 748-  assertEquals(DATEVALUE("01-2017 10:10:10am"), 42736);
 749-  assertEquals(DATEVALUE("01-2017  10  am"), 42736);
 750-  assertEquals(DATEVALUE("01-2017 10: 10 "), 42736);
 751-  assertEquals(DATEVALUE("01-2017 10: 10 pm"), 42736);
 752-  assertEquals(DATEVALUE("01-2017 10: 10: 10"), 42736);
 753-  assertEquals(DATEVALUE("01-2017  10: 10: 10    am   "), 42736);
 754-  // YEAR_MONTHNAME, YYYY(fd)Month, '1992/Aug' =========================================================================
 755   assertEquals(DATEVALUE("2017 January"), 42736);
 756-  assertEquals(DATEVALUE("2017 February"), 42767);
 757-  assertEquals(DATEVALUE("2017 March"), 42795);
 758-  assertEquals(DATEVALUE("2017 April"), 42826);
 759-  assertEquals(DATEVALUE("2017 May"), 42856);
 760-  assertEquals(DATEVALUE("2017 June"), 42887);
 761-  assertEquals(DATEVALUE("2017 July"), 42917);
 762-  assertEquals(DATEVALUE("2017 August"), 42948);
 763-  assertEquals(DATEVALUE("2017 September"), 42979);
 764-  assertEquals(DATEVALUE("2017 October"), 43009);
 765-  assertEquals(DATEVALUE("2017 November"), 43040);
 766-  assertEquals(DATEVALUE("2017 December"), 43070);
 767-  // delimiter tests
 768-  assertEquals(DATEVALUE("Thursday 2017 January"), 42736);
 769-  assertEquals(DATEVALUE("Thursday, 2017 January"), 42736);
 770-  assertEquals(DATEVALUE("2017/January"), 42736);
 771-  assertEquals(DATEVALUE("2017-January"), 42736);
 772-  assertEquals(DATEVALUE("2017. January"), 42736);
 773-  assertEquals(DATEVALUE("2017, January"), 42736);
 774-  // Comma delimiters should be followed by spaces.
 775-  catchAndAssertEquals(function() {
 776-    DATEVALUE("2017,January");
 777-  }, ERRORS.VALUE_ERROR);
 778-  catchAndAssertEquals(function() {
 779-    DATEVALUE("2017.January");
 780-  }, ERRORS.VALUE_ERROR);
 781-  // timestamp test
 782   assertEquals(DATEVALUE("2017-January 10am"), 42736);
 783   assertEquals(DATEVALUE("2017-January 10:10"), 42736);
 784   assertEquals(DATEVALUE("2017-January 10:10am"), 42736);
 785   assertEquals(DATEVALUE("2017-January 10:10:10"), 42736);
 786   assertEquals(DATEVALUE("2017-January 10:10:10am"), 42736);
 787-  assertEquals(DATEVALUE("2017-January  10  am"), 42736);
 788-  assertEquals(DATEVALUE("2017-January 10: 10 "), 42736);
 789-  assertEquals(DATEVALUE("2017-January 10: 10 pm"), 42736);
 790-  assertEquals(DATEVALUE("2017-January 10: 10: 10"), 42736);
 791-  assertEquals(DATEVALUE("2017-January  10: 10: 10    am   "), 42736);
 792-  // MONTHNAME_YEAR, Month(fd)YYYY, 'Aug 1992' =========================================================================
 793   assertEquals(DATEVALUE("January 2017"), 42736);
 794-  assertEquals(DATEVALUE("February 2017"), 42767);
 795-  assertEquals(DATEVALUE("March 2017"), 42795);
 796-  assertEquals(DATEVALUE("April 2017"), 42826);
 797-  assertEquals(DATEVALUE("May 2017"), 42856);
 798-  assertEquals(DATEVALUE("June 2017"), 42887);
 799-  assertEquals(DATEVALUE("July 2017"), 42917);
 800-  assertEquals(DATEVALUE("August 2017"), 42948);
 801-  assertEquals(DATEVALUE("September 2017"), 42979);
 802-  assertEquals(DATEVALUE("October 2017"), 43009);
 803-  assertEquals(DATEVALUE("November 2017"), 43040);
 804-  assertEquals(DATEVALUE("December 2017"), 43070);
 805-  assertEquals(DATEVALUE("  Feb    2017  "), 42767);
 806-  assertEquals(DATEVALUE("Feb-2017"), 42767);
 807-  assertEquals(DATEVALUE("Feb. 2017"), 42767);
 808-  assertEquals(DATEVALUE("Feb/2017"), 42767);
 809-  assertEquals(DATEVALUE("Feb    .    2017"), 42767);
 810-  assertEquals(DATEVALUE("Feb -      2017"), 42767);
 811   assertEquals(DATEVALUE("January 0030"), 10959);
 812   assertEquals(DATEVALUE("November 4243"), 856069);
 813   assertEquals(DATEVALUE("December 0100"), -657100);
 814   assertEquals(DATEVALUE("Jan 2017"), 42736);
 815-  assertEquals(DATEVALUE("Feb 2017"), 42767);
 816-  assertEquals(DATEVALUE("Mar 2017"), 42795);
 817-  assertEquals(DATEVALUE("Apr 2017"), 42826);
 818-  assertEquals(DATEVALUE("May 2017"), 42856);
 819-  assertEquals(DATEVALUE("Jun 2017"), 42887);
 820-  assertEquals(DATEVALUE("Jul 2017"), 42917);
 821-  assertEquals(DATEVALUE("Aug 2017"), 42948);
 822-  assertEquals(DATEVALUE("Sep 2017"), 42979);
 823-  assertEquals(DATEVALUE("Oct 2017"), 43009);
 824-  assertEquals(DATEVALUE("Nov 2017"), 43040);
 825-  assertEquals(DATEVALUE("Dec 2017"), 43070);
 826-  assertEquals(DATEVALUE("Feb, 2017"), 42767);
 827-  catchAndAssertEquals(function() {
 828-    DATEVALUE("December 100");// need 4 digits
 829+  assertEquals(DATEVALUE("January-2017 10am"), 42736);
 830+  assertEquals(DATEVALUE("January-2017 10:10"), 42736);
 831+  assertEquals(DATEVALUE("January-2017 10:10am"), 42736);
 832+  assertEquals(DATEVALUE("January-2017 10:10:10"), 42736);
 833+  assertEquals(DATEVALUE("January-2017 10:10:10am"), 42736);
 834+  catchAndAssertEquals(function() {
 835+    DATEVALUE("6/24/92", 10);
 836+  }, ERRORS.NA_ERROR);
 837+  catchAndAssertEquals(function() {
 838+    DATEVALUE();
 839+  }, ERRORS.NA_ERROR);
 840+  catchAndAssertEquals(function() {
 841+    DATEVALUE(false);
 842+  }, ERRORS.VALUE_ERROR);
 843+  catchAndAssertEquals(function() {
 844+    DATEVALUE("Sunday,1992/6/24");
 845   }, ERRORS.VALUE_ERROR);
 846   catchAndAssertEquals(function() {
 847-    DATEVALUE("Dec.20");// need space after if using period
 848+    DATEVALUE("2005/2/29");
 849   }, ERRORS.VALUE_ERROR);
 850-  // delimiter tests
 851-  assertEquals(DATEVALUE("Thursday January 2017"), 42736);
 852-  assertEquals(DATEVALUE("Thursday, January 2017"), 42736);
 853-  assertEquals(DATEVALUE("January/2017"), 42736);
 854-  assertEquals(DATEVALUE("January-2017"), 42736);
 855-  assertEquals(DATEVALUE("January. 2017"), 42736);
 856-  assertEquals(DATEVALUE("January, 2017"), 42736);
 857-  // Comma, period delimiters should be followed by spaces.
 858-  catchAndAssertEquals(function() {
 859-    DATEVALUE("January,2017");
 860+  catchAndAssertEquals(function() {
 861+    DATEVALUE("2001/2/29");
 862   }, ERRORS.VALUE_ERROR);
 863   catchAndAssertEquals(function() {
 864-    DATEVALUE("January.2017");
 865+    DATEVALUE("2005/1/44");
 866   }, ERRORS.VALUE_ERROR);
 867-  // timestamp test
 868-  assertEquals(DATEVALUE("January-2017 10am"), 42736);
 869-  assertEquals(DATEVALUE("January-2017 10:10"), 42736);
 870-  assertEquals(DATEVALUE("January-2017 10:10am"), 42736);
 871-  assertEquals(DATEVALUE("January-2017 10:10:10"), 42736);
 872-  assertEquals(DATEVALUE("January-2017 10:10:10am"), 42736);
 873-  assertEquals(DATEVALUE("January-2017  10  am"), 42736);
 874-  assertEquals(DATEVALUE("January-2017 10: 10 "), 42736);
 875-  assertEquals(DATEVALUE("January-2017 10: 10 pm"), 42736);
 876-  assertEquals(DATEVALUE("January-2017 10: 10: 10"), 42736);
 877-  assertEquals(DATEVALUE("January-2017  10: 10: 10    am  "), 42736);
 878 });
 879diff --git a/tests/Utilities/TypeConverterTest.ts b/tests/Utilities/TypeConverterTest.ts
 880new file mode 100644
 881index 0000000..3d3e831
 882--- /dev/null
 883+++ b/tests/Utilities/TypeConverterTest.ts
 884@@ -0,0 +1,828 @@
 885+/// <reference path="../../node_modules/moment/moment.d.ts"/>
 886+import * as moment from "moment";
 887+import {
 888+  assertEquals,
 889+  test, catchAndAssertEquals
 890+} from "../Utils/Asserts";
 891+import {
 892+  TypeConverter
 893+} from "../../src/Utilities/TypeConverter";
 894+import {VALUE_ERROR, REF_ERROR} from "../../src/Errors";
 895+
 896+test("TypeConverter.unitsToTimeNumber", function () {
 897+  assertEquals(TypeConverter.unitsToTimeNumber(10, 10, 10), 0.4237268518518518);
 898+  assertEquals(TypeConverter.unitsToTimeNumber(34, 10, 10), 0.4237268518518518);
 899+  assertEquals(TypeConverter.unitsToTimeNumber(0, 0, 0), 0);
 900+  assertEquals(TypeConverter.unitsToTimeNumber(24, 0, 0), 0);
 901+  assertEquals(TypeConverter.unitsToTimeNumber(23, 60, 0), 0);
 902+  assertEquals(TypeConverter.unitsToTimeNumber(23, 59, 60), 0);
 903+});
 904+
 905+
 906+test("TypeConverter.numberToMoment", function () {
 907+  assertEquals(TypeConverter.numberToMoment(10).format("M/D/YYYY"), "1/9/1900");
 908+  assertEquals(TypeConverter.numberToMoment(2).format("M/D/YYYY"), "1/1/1900");
 909+  assertEquals(TypeConverter.numberToMoment(1).format("M/D/YYYY"), "12/31/1899");
 910+  assertEquals(TypeConverter.numberToMoment(0).format("M/D/YYYY"), "12/30/1899");
 911+  assertEquals(TypeConverter.numberToMoment(10000).format("M/D/YYYY"), "5/18/1927");
 912+  assertEquals(TypeConverter.numberToMoment(10001).format("M/D/YYYY"), "5/19/1927");
 913+  assertEquals(TypeConverter.numberToMoment(-1000).format("M/D/YYYY"), "4/4/1897");
 914+  assertEquals(TypeConverter.numberToMoment(10.1).format("M/D/YYYY"), "1/9/1900");
 915+  assertEquals(TypeConverter.numberToMoment(2.44).format("M/D/YYYY"), "1/1/1900");
 916+  assertEquals(TypeConverter.numberToMoment(1.44).format("M/D/YYYY"), "12/31/1899");
 917+  assertEquals(TypeConverter.numberToMoment(1.99).format("M/D/YYYY"), "1/1/1900");
 918+  assertEquals(TypeConverter.numberToMoment(0.78).format("M/D/YYYY"), "12/31/1899");
 919+});
 920+
 921+
 922+test("TypeConverter.momentToDayNumber", function () {
 923+  assertEquals(TypeConverter.momentToDayNumber(moment.utc("1900-01-09")), 10);
 924+  assertEquals(TypeConverter.momentToDayNumber(moment.utc("1900-01-01")), 2);
 925+  assertEquals(TypeConverter.momentToDayNumber(moment.utc("1899-12-31")), 1);
 926+  assertEquals(TypeConverter.momentToDayNumber(moment.utc("1899-12-30")), 0);
 927+  assertEquals(TypeConverter.momentToDayNumber(moment.utc("1927-05-18")), 10000);
 928+  assertEquals(TypeConverter.momentToDayNumber(moment.utc("1927-05-19")), 10001);
 929+  assertEquals(TypeConverter.momentToDayNumber(moment.utc("1897-04-04")), -1000);
 930+});
 931+
 932+
 933+test("TypeConverter.momentToNumber", function () {
 934+  assertEquals(TypeConverter.momentToNumber(moment.utc("1900-01-09")), 10);
 935+  assertEquals(TypeConverter.momentToNumber(moment.utc("1900-01-01")), 2);
 936+  assertEquals(TypeConverter.momentToNumber(moment.utc("1899-12-31")), 1);
 937+  assertEquals(TypeConverter.momentToNumber(moment.utc("1899-12-30")), 0);
 938+  assertEquals(TypeConverter.momentToNumber(moment.utc("1927-05-18")), 10000);
 939+  assertEquals(TypeConverter.momentToNumber(moment.utc("1927-05-19")), 10001);
 940+  assertEquals(TypeConverter.momentToNumber(moment.utc("1897-04-04")), -1000);
 941+  assertEquals(TypeConverter.momentToNumber(moment.utc("1900-01-09T16:11:57+00:00")), 10.674965277777778);
 942+  assertEquals(TypeConverter.momentToNumber(moment.utc("1900-01-01T16:11:57+00:00")), 2.674965277777778);
 943+  assertEquals(TypeConverter.momentToNumber(moment.utc("1899-12-31T12:00:00+00:00")), 1.5);
 944+  assertEquals(TypeConverter.momentToNumber(moment.utc("1899-12-31T18:00:00+00:00")), 1.75);
 945+});
 946+
 947+
 948+test("TypeConverter.valueToDateNumber", function () {
 949+  assertEquals(TypeConverter.valueToDateNumber(10), 10);
 950+  assertEquals(TypeConverter.valueToDateNumber("10"), 10);
 951+  assertEquals(TypeConverter.valueToDateNumber("10.0"), 10);
 952+  assertEquals(TypeConverter.valueToDateNumber("1992-1-1"), 33604);
 953+  assertEquals(TypeConverter.valueToDateNumber("1992-1-2"), 33605);
 954+  assertEquals(TypeConverter.valueToDateNumber(false, true), 0);
 955+  assertEquals(TypeConverter.valueToDateNumber(true, true), 1);
 956+  catchAndAssertEquals(function () {
 957+    TypeConverter.valueToDateNumber(false); // Do not convert boolean
 958+  }, VALUE_ERROR);
 959+  catchAndAssertEquals(function () {
 960+    console.log(TypeConverter.valueToDateNumber("str"));
 961+  }, VALUE_ERROR);
 962+});
 963+
 964+
 965+test("TypeConverter.firstValueAsDateNumber", function () {
 966+  assertEquals(TypeConverter.firstValueAsDateNumber([10]), 10);
 967+  assertEquals(TypeConverter.firstValueAsDateNumber([[10]]), 10);
 968+  assertEquals(TypeConverter.firstValueAsDateNumber([[[[[10]]]]]), 10);
 969+  assertEquals(TypeConverter.firstValueAsDateNumber(["10"]), 10);
 970+  assertEquals(TypeConverter.firstValueAsDateNumber(["10.0"]), 10);
 971+  assertEquals(TypeConverter.firstValueAsDateNumber(["1992-1-1"]), 33604);
 972+  assertEquals(TypeConverter.firstValueAsDateNumber(["1992-1-2"]), 33605);
 973+  assertEquals(TypeConverter.firstValueAsDateNumber([false], true), 0);
 974+  assertEquals(TypeConverter.firstValueAsDateNumber([true], true), 1);
 975+  catchAndAssertEquals(function () {
 976+    TypeConverter.firstValueAsDateNumber([false]); // Do not convert boolean
 977+  }, VALUE_ERROR);
 978+  catchAndAssertEquals(function () {
 979+    TypeConverter.firstValueAsDateNumber(["str"]);
 980+  }, VALUE_ERROR);
 981+  catchAndAssertEquals(function () {
 982+    TypeConverter.firstValueAsDateNumber([[], 10]);
 983+  }, REF_ERROR);
 984+});
 985+
 986+
 987+test("TypeConverter.firstValue", function () {
 988+  assertEquals(TypeConverter.firstValue([10, 0]), 10);
 989+  assertEquals(TypeConverter.firstValue([[[[10]]], 0]), 10);
 990+  assertEquals(TypeConverter.firstValue(["10"]), "10");
 991+  assertEquals(TypeConverter.firstValue(["string", 22]), "string");
 992+  catchAndAssertEquals(function () {
 993+    TypeConverter.firstValue([[], 10]);
 994+  }, REF_ERROR);
 995+});
 996+
 997+
 998+test("TypeConverter.valueToTimestampNumber", function () {
 999+  assertEquals(TypeConverter.valueToTimestampNumber(10), 10);
1000+  assertEquals(TypeConverter.valueToTimestampNumber(""), 0);
1001+  assertEquals(TypeConverter.valueToTimestampNumber("12:00pm"), 0.5);
1002+  assertEquals(TypeConverter.valueToTimestampNumber("12:00"), 0.5);
1003+  assertEquals(TypeConverter.valueToTimestampNumber("12pm"), 0.5);
1004+  assertEquals(TypeConverter.valueToTimestampNumber("10:10am"), 0.4236111111111111);
1005+  assertEquals(TypeConverter.valueToTimestampNumber("10:10:10am"), 0.4237268518518518);
1006+  assertEquals(TypeConverter.valueToTimestampNumber("22:10:10"), 0.9237268518518519);
1007+  assertEquals(TypeConverter.valueToTimestampNumber("1:10:10"), 0.048726851851851855);
1008+  assertEquals(TypeConverter.valueToTimestampNumber("25:10:10"), 0.048726851851851855);
1009+  assertEquals(TypeConverter.valueToTimestampNumber(false), 0);
1010+  assertEquals(TypeConverter.valueToTimestampNumber(true), 0);
1011+  catchAndAssertEquals(function () {
1012+    TypeConverter.valueToTimestampNumber("str");
1013+  }, VALUE_ERROR);
1014+});
1015+
1016+
1017+test("TypeConverter.valueToString", function () {
1018+  assertEquals(TypeConverter.valueToString(10), "10");
1019+  assertEquals(TypeConverter.valueToString("10"), "10");
1020+  assertEquals(TypeConverter.valueToString("This is a string"), "This is a string");
1021+  assertEquals(TypeConverter.valueToString(10.3712638712), "10.3712638712");
1022+  assertEquals(TypeConverter.valueToString(-0.33824284782334), "-0.33824284782334");
1023+  assertEquals(TypeConverter.valueToString(false), "FALSE");
1024+  assertEquals(TypeConverter.valueToString(true), "TRUE");
1025+});
1026+
1027+
1028+test("TypeConverter.valueToBoolean", function () {
1029+  assertEquals(TypeConverter.valueToBoolean(10), true);
1030+  assertEquals(TypeConverter.valueToBoolean(-10), true);
1031+  assertEquals(TypeConverter.valueToBoolean(1.11111), true);
1032+  assertEquals(TypeConverter.valueToBoolean(0), false);
1033+  assertEquals(TypeConverter.valueToBoolean(false), false);
1034+  assertEquals(TypeConverter.valueToBoolean(true), true);
1035+  catchAndAssertEquals(function () {
1036+    TypeConverter.valueToBoolean("str");
1037+  }, VALUE_ERROR);
1038+});
1039+
1040+
1041+test("TypeConverter.valueToNumber", function () {
1042+  assertEquals(TypeConverter.valueToNumber(10), 10);
1043+  assertEquals(TypeConverter.valueToNumber(-10), -10);
1044+  assertEquals(TypeConverter.valueToNumber(1.11111), 1.11111);
1045+  assertEquals(TypeConverter.valueToNumber(0), 0);
1046+  assertEquals(TypeConverter.valueToNumber(false), 0);
1047+  assertEquals(TypeConverter.valueToNumber(true), 1);
1048+  assertEquals(TypeConverter.valueToNumber("10"), 10);
1049+  assertEquals(TypeConverter.valueToNumber("-10"), -10);
1050+  assertEquals(TypeConverter.valueToNumber("1.4832749823"), 1.4832749823);
1051+  assertEquals(TypeConverter.valueToNumber("   1.4832749823   "), 1.4832749823);
1052+  assertEquals(TypeConverter.valueToNumber("$10"), 10);
1053+  assertEquals(TypeConverter.valueToNumber("$10.217983172"), 10.217983172);
1054+  assertEquals(TypeConverter.valueToNumber("-$10.217983172"), -10.217983172);
1055+  catchAndAssertEquals(function () {
1056+    TypeConverter.valueToNumber("str");
1057+  }, VALUE_ERROR);
1058+});
1059+
1060+
1061+test("TypeConverter.valueToNumberGracefully", function () {
1062+  assertEquals(TypeConverter.valueToNumberGracefully(10), 10);
1063+  assertEquals(TypeConverter.valueToNumberGracefully(-10), -10);
1064+  assertEquals(TypeConverter.valueToNumberGracefully(1.11111), 1.11111);
1065+  assertEquals(TypeConverter.valueToNumberGracefully(0), 0);
1066+  assertEquals(TypeConverter.valueToNumberGracefully(false), 0);
1067+  assertEquals(TypeConverter.valueToNumberGracefully(true), 1);
1068+  assertEquals(TypeConverter.valueToNumberGracefully("10"), 10);
1069+  assertEquals(TypeConverter.valueToNumberGracefully("-10"), -10);
1070+  assertEquals(TypeConverter.valueToNumberGracefully("1.4832749823"), 1.4832749823);
1071+  assertEquals(TypeConverter.valueToNumberGracefully("   1.4832749823   "), 1.4832749823);
1072+  assertEquals(TypeConverter.valueToNumberGracefully("$10"), 10);
1073+  assertEquals(TypeConverter.valueToNumberGracefully("$10.217983172"), 10.217983172);
1074+  assertEquals(TypeConverter.valueToNumberGracefully("-$10.217983172"), -10.217983172);
1075+  assertEquals(TypeConverter.valueToNumberGracefully("dkasjdkljasjdas"), 0);
1076+});
1077+
1078+
1079+test("TypeConverter.stringToDateNumber", function () {
1080+  // MONTHDIG_DAY_YEAR, MM(fd)DD(fd)YYYY ===============================================================================
1081+  assertEquals(TypeConverter.stringToDateNumber("6/24/92"), 33779);
1082+  assertEquals(TypeConverter.stringToDateNumber("6/24/1992"), 33779);
1083+  assertEquals(TypeConverter.stringToDateNumber("06/24/1992"), 33779);
1084+  assertEquals(TypeConverter.stringToDateNumber("1/01/1999"), 36161);
1085+  assertEquals(TypeConverter.stringToDateNumber("1/01/99"), 36161);
1086+  assertEquals(TypeConverter.stringToDateNumber("1/01/2222"), 117610);
1087+  assertEquals(TypeConverter.stringToDateNumber("9/02/1902"), 976);
1088+  assertEquals(TypeConverter.stringToDateNumber("9/2/1902"), 976);
1089+  assertEquals(TypeConverter.stringToDateNumber("11/3/4243"), 856071);
1090+  assertEquals(TypeConverter.stringToDateNumber("  04/19/1992  "), 33713);
1091+  assertEquals(TypeConverter.stringToDateNumber("5/20/1992"), 33744);
1092+  assertEquals(TypeConverter.stringToDateNumber("6/21/1992"), 33776);
1093+  assertEquals(TypeConverter.stringToDateNumber("9/29/1992"), 33876);
1094+  assertEquals(TypeConverter.stringToDateNumber("1/24/1992"), 33627);
1095+  assertEquals(TypeConverter.stringToDateNumber("12/21/1992"), 33959);
1096+  assertEquals(TypeConverter.stringToDateNumber("01/31/1992"), 33634);
1097+  assertEquals(TypeConverter.stringToDateNumber("1/13/1992"), 33616);
1098+  assertEquals(TypeConverter.stringToDateNumber("2/29/2004"), 38046);
1099+  assertEquals(TypeConverter.stringToDateNumber("2/28/2004"), 38045);
1100+  assertEquals(TypeConverter.stringToDateNumber("2/28/004"), 38045);
1101+  assertEquals(TypeConverter.stringToDateNumber("2/28/04"), 38045);
1102+  assertEquals(TypeConverter.stringToDateNumber("2/28/4"), 38045);
1103+  assertEquals(TypeConverter.stringToDateNumber("1/13/1999"), 36173);
1104+  assertEquals(TypeConverter.stringToDateNumber("01/13/1999"), 36173);
1105+  assertEquals(TypeConverter.stringToDateNumber("01/13/0999"), -329069);
1106+  assertEquals(TypeConverter.stringToDateNumber("01/13/1200"), -255656);
1107+  assertEquals(TypeConverter.stringToDateNumber("01/13/0029"), 47131);
1108+  assertEquals(TypeConverter.stringToDateNumber("01/13/0030"), 10971);
1109+  assertEquals(TypeConverter.stringToDateNumber("01/13/0044"), 16084);
1110+  assertEquals(TypeConverter.stringToDateNumber("01/13/0050"), 18276);
1111+  assertEquals(TypeConverter.stringToDateNumber("01/13/0097"), 35443);
1112+  assertEquals(TypeConverter.stringToDateNumber("01/13/0099"), 36173);
1113+  assertEquals(TypeConverter.stringToDateNumber("01/13/0000"), 36538);
1114+  assertEquals(TypeConverter.stringToDateNumber("01/13/0101"), -657057);
1115+  assertEquals(TypeConverter.stringToDateNumber("01/13/0100"), -657422);
1116+  assertEquals(TypeConverter.stringToDateNumber("12/31/100"), -657070);
1117+  assertEquals(TypeConverter.stringToDateNumber("11/10/122"), -649086);
1118+  assertEquals(TypeConverter.stringToDateNumber("1/22/2222"), 117631);
1119+  assertEquals(TypeConverter.stringToDateNumber("1/22/222"), -612854);
1120+  // delimiter tests
1121+  assertEquals(TypeConverter.stringToDateNumber("6-24-92"), 33779);
1122+  assertEquals(TypeConverter.stringToDateNumber("6/24/92"), 33779);
1123+  assertEquals(TypeConverter.stringToDateNumber("6 24 92"), 33779);
1124+  assertEquals(TypeConverter.stringToDateNumber("6.24.92"), 33779);
1125+  assertEquals(TypeConverter.stringToDateNumber("6 . 24 . 92"), 33779);
1126+  assertEquals(TypeConverter.stringToDateNumber("6 / 24 / 92"), 33779);
1127+  assertEquals(TypeConverter.stringToDateNumber("6, 24, 92"), 33779);
1128+  // flex delimiter should not allow a comma without a space after it.
1129+  catchAndAssertEquals(function() {
1130+    TypeConverter.stringToDateNumber("Sunday,6/24/92");
1131+  }, VALUE_ERROR);
1132+  // Leap day on non-leap years
1133+  catchAndAssertEquals(function() {
1134+    TypeConverter.stringToDateNumber("2/29/2005");
1135+  }, VALUE_ERROR);
1136+  catchAndAssertEquals(function() {
1137+    TypeConverter.stringToDateNumber("2/29/2001");
1138+  }, VALUE_ERROR);
1139+  // Out of range day for any month
1140+  catchAndAssertEquals(function() {
1141+    TypeConverter.stringToDateNumber("1/44/2005");
1142+  }, VALUE_ERROR);
1143+  // timestamp test
1144+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10am"), 33779);
1145+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10:10"), 33779);
1146+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10:10am"), 33779);
1147+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10:10:10"), 33779);
1148+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10:10:10am"), 33779);
1149+  assertEquals(TypeConverter.stringToDateNumber("6-24-92  10  am"), 33779);
1150+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10: 10 "), 33779);
1151+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10: 10 pm"), 33779);
1152+  assertEquals(TypeConverter.stringToDateNumber("6-24-92 10: 10: 10"), 33779);
1153+  assertEquals(TypeConverter.stringToDateNumber("6-24-92  10: 10: 10    am  "), 33779);
1154+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 00:00"), 33779);
1155+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 0:00"), 33779);
1156+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 10:10"), 33779);
1157+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 16:22"), 33779);
1158+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 25:10"), 33780);
1159+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 23:60"), 33780);
1160+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 24:00"), 33780);
1161+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 23:59"), 33779);
1162+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13 10:11111111"), 43889);
1163+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13 25000:22"), 37214);
1164+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13 25000:    22"), 37214);
1165+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 00:00am"), 33779);
1166+  assertEquals(TypeConverter.stringToDateNumber("1992/06/24 01:44am "), 33779);
1167+  assertEquals(TypeConverter.stringToDateNumber("1999/1/01 02:59pm"), 36161);
1168+  assertEquals(TypeConverter.stringToDateNumber("2222/1/01 03:33pm"), 117610);
1169+  assertEquals(TypeConverter.stringToDateNumber("1902/9/02 12:33pm"), 976);
1170+  assertEquals(TypeConverter.stringToDateNumber("1902/9/2 12:33pm"), 976);
1171+  assertEquals(TypeConverter.stringToDateNumber("4243/11/3 12:33pm"), 856071);
1172+  assertEquals(TypeConverter.stringToDateNumber("  1992/04/19   12:  33pm   "), 33713);
1173+  assertEquals(TypeConverter.stringToDateNumber("1992/5/20 01:33am"), 33744);
1174+  assertEquals(TypeConverter.stringToDateNumber("1992/6/21  3:33pm"), 33776);
1175+  assertEquals(TypeConverter.stringToDateNumber("1992/9/29 3:33pm"), 33876);
1176+  assertEquals(TypeConverter.stringToDateNumber("1992/1/24 3:33pm"), 33627);
1177+  assertEquals(TypeConverter.stringToDateNumber("1992/12/21 3:33pm"), 33959);
1178+  assertEquals(TypeConverter.stringToDateNumber("1992/01/31 3:33pm"), 33634);
1179+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 3:33pm"), 33616);
1180+  assertEquals(TypeConverter.stringToDateNumber("2004/2/29 3:33pm"), 38046);
1181+  assertEquals(TypeConverter.stringToDateNumber("2004/2/28  3:33pm "), 38045);
1182+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13 3:33pm"), 36173);
1183+  assertEquals(TypeConverter.stringToDateNumber("1999/01/13 3:33pm"), 36173);
1184+  assertEquals(TypeConverter.stringToDateNumber("0999/01/13 3:33pm"), -329069);
1185+  assertEquals(TypeConverter.stringToDateNumber("1200/01/13 3:33pm"), -255656);
1186+  assertEquals(TypeConverter.stringToDateNumber("0029/01/13 3:33pm"), 47131);
1187+  assertEquals(TypeConverter.stringToDateNumber("0030/01/13 3:33pm"), 10971);
1188+  assertEquals(TypeConverter.stringToDateNumber("0044/01/13 3:33pm"), 16084);
1189+  assertEquals(TypeConverter.stringToDateNumber("0050/01/13 3:33pm"), 18276);
1190+  assertEquals(TypeConverter.stringToDateNumber("0097/01/13 00:33pm"), 35443);
1191+  assertEquals(TypeConverter.stringToDateNumber("0099/01/13 3:33pm"), 36173);
1192+  assertEquals(TypeConverter.stringToDateNumber("0000/01/13 3:33pm"), 36538);
1193+  assertEquals(TypeConverter.stringToDateNumber("0101/01/13 3:33pm"), -657057);
1194+  assertEquals(TypeConverter.stringToDateNumber("0100/01/13 3:33pm"), -657422);
1195+  assertEquals(TypeConverter.stringToDateNumber("100/12/31 3:33pm"), -657070);
1196+  assertEquals(TypeConverter.stringToDateNumber("122/11/10 3:33pm"), -649086);
1197+  assertEquals(TypeConverter.stringToDateNumber("2222/1/22 3:33pm"), 117631);
1198+  assertEquals(TypeConverter.stringToDateNumber("222/1/22 3:33pm"), -612854);
1199+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 6:22222222am"), 49048); // overload minutes
1200+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:720pm"), 33617); // overload minutes
1201+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 00:720pm"), 33617); // overload minutes
1202+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:719pm"), 33616); // overload minutes
1203+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 00:720am"), 33616); // overload minutes
1204+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 00:01pm"), 33616); // overload minutes
1205+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66669pm"), 33662); // overload minutes
1206+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66669am"), 33662); // overload minutes
1207+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66249pm"), 33662); // overload minutes
1208+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66249am"), 33662); // overload minutes
1209+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:666669am"), 34078); // overload minutes
1210+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:666669pm"), 34079); // overload minutes
1211+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:100000000am"), 103060); // overload minutes
1212+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:0912347287am"), 667190); // overload minutes
1213+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:00000912347287am"), 667190); // overload minutes
1214+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:1989198298am"), 1415003); // overload minutes
1215+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 0:0:0"), 33779);
1216+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 0000:0000:0000"), 33779);
1217+  assertEquals(TypeConverter.stringToDateNumber("0000/01/13 3:33:999999999"), 48112); // overload seconds
1218+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 6:22222222:0"), 49048); // overload minutes
1219+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:912347287:10"), 667191); // overload minutes
1220+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:100000000:10"), 103060); // overload minutes
1221+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 23:720:10"), 33617); // overload minutes
1222+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 23:719:60"), 33617); // overload minutes, seconds
1223+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 24:00:00"), 33780); // overload hours
1224+  assertEquals(TypeConverter.stringToDateNumber("1999/1/01 200000000:999999999:923231312"), 9074624); // overload hours, minutes, seconds
1225+  assertEquals(TypeConverter.stringToDateNumber("  1992/04/19   12:  33: 11  "), 33713);
1226+  assertEquals(TypeConverter.stringToDateNumber("0000/01/13 3:33:33"), 36538);
1227+  assertEquals(TypeConverter.stringToDateNumber("4243/11/3 200000000:33:444"), 9189404);
1228+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13 10:10:10pm"), 36173);
1229+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 0:0:0pm"), 33779);
1230+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 00:0000:0000pm"), 33779);
1231+  assertEquals(TypeConverter.stringToDateNumber("0000/01/13 3:33:999999999pm"), 48112); // overload seconds
1232+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 6:22222222:0pm"), 49048); // overload minutes
1233+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:912347287:10pm"), 667191); // overload minutes
1234+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:100000000:10pm"), 103060); // overload minutes
1235+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 00:00:00am"), 33779);
1236+  assertEquals(TypeConverter.stringToDateNumber("1992/06/24 01:44:00am "), 33779);
1237+  assertEquals(TypeConverter.stringToDateNumber("1999/1/01 02:59:00pm"), 36161);
1238+  assertEquals(TypeConverter.stringToDateNumber("2222/1/01 03:33:00pm"), 117610);
1239+  assertEquals(TypeConverter.stringToDateNumber("1902/9/02 12:33:00pm"), 976);
1240+  assertEquals(TypeConverter.stringToDateNumber("1902/9/2 12:33:00pm"), 976);
1241+  assertEquals(TypeConverter.stringToDateNumber("4243/11/3 12:33:00pm"), 856071);
1242+  assertEquals(TypeConverter.stringToDateNumber("  1992/04/19   12:  33:  00  pm   "), 33713);
1243+  assertEquals(TypeConverter.stringToDateNumber("1992/5/20 01:33:44am"), 33744);
1244+  assertEquals(TypeConverter.stringToDateNumber("1992/6/21  3:33:44pm"), 33776);
1245+  assertEquals(TypeConverter.stringToDateNumber("1992/9/29 3:33:44pm"), 33876);
1246+  assertEquals(TypeConverter.stringToDateNumber("1992/1/24 3:33:44pm"), 33627);
1247+  assertEquals(TypeConverter.stringToDateNumber("1992/12/21 3:33:44pm"), 33959);
1248+  assertEquals(TypeConverter.stringToDateNumber("1992/01/31 3:33:44pm"), 33634);
1249+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 3:33:44pm"), 33616);
1250+  assertEquals(TypeConverter.stringToDateNumber("2004/2/29 3:33:44pm"), 38046);
1251+  assertEquals(TypeConverter.stringToDateNumber("2004/2/28  3:33:44pm "), 38045);
1252+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13 3:33:44pm"), 36173);
1253+  assertEquals(TypeConverter.stringToDateNumber("1999/01/13 3:33:44pm"), 36173);
1254+  assertEquals(TypeConverter.stringToDateNumber("0999/01/13 3:33:44pm"), -329069);
1255+  assertEquals(TypeConverter.stringToDateNumber("1200/01/13 3:33:44pm"), -255656);
1256+  assertEquals(TypeConverter.stringToDateNumber("0029/01/13 3:33:44pm"), 47131);
1257+  assertEquals(TypeConverter.stringToDateNumber("0030/01/13 3:33:44pm"), 10971);
1258+  assertEquals(TypeConverter.stringToDateNumber("0044/01/13 3:33:44pm"), 16084);
1259+  assertEquals(TypeConverter.stringToDateNumber("0050/01/13 3:33:44pm"), 18276);
1260+  assertEquals(TypeConverter.stringToDateNumber("0097/01/13 00:33:44pm"), 35443);
1261+  assertEquals(TypeConverter.stringToDateNumber("0099/01/13 3:33:44pm"), 36173);
1262+  assertEquals(TypeConverter.stringToDateNumber("0000/01/13 3:33:44pm"), 36538);
1263+  assertEquals(TypeConverter.stringToDateNumber("0101/01/13 3:33:44pm"), -657057);
1264+  assertEquals(TypeConverter.stringToDateNumber("0100/01/13 3:33:44pm"), -657422);
1265+  assertEquals(TypeConverter.stringToDateNumber("100/12/31 3:33:44pm"), -657070);
1266+  assertEquals(TypeConverter.stringToDateNumber("122/11/10 3:33:44pm"), -649086);
1267+  assertEquals(TypeConverter.stringToDateNumber("2222/1/22 3:33:44pm"), 117631);
1268+  assertEquals(TypeConverter.stringToDateNumber("222/1/22 3:33:44pm"), -612854);
1269+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 6:22222222:44am"), 49048); // overload minutes
1270+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:720:00pm"), 33617); // overload minutes
1271+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 00:720:00pm"), 33617); // overload minutes
1272+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:719:00pm"), 33616); // overload minutes
1273+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 00:720:00am"), 33616); // overload minutes
1274+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:719:60pm"), 33617); // overload minutes
1275+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 00:720:00am"), 33616); // overload minutes
1276+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 00:01:00pm"), 33616); // overload minutes
1277+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66669:00pm"), 33662); // overload minutes
1278+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66669:00am"), 33662); // overload minutes
1279+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66249:00pm"), 33662); // overload minutes
1280+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:66249:00am"), 33662); // overload minutes
1281+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:666669:00am"), 34078); // overload minutes
1282+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:666669:00pm"), 34079); // overload minutes
1283+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:100000000:00am"), 103060); // overload minutes
1284+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 12:912347287:00am"), 667190); // overload minutes
1285+  // YEAR_MONTHDIG_DAY, YYYY(fd)MM(fd)DD ===============================================================================
1286+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24"), 33779);
1287+  assertEquals(TypeConverter.stringToDateNumber("1992/06/24"), 33779);
1288+  assertEquals(TypeConverter.stringToDateNumber("1999/1/01"), 36161);
1289+  assertEquals(TypeConverter.stringToDateNumber("2222/1/01"), 117610);
1290+  assertEquals(TypeConverter.stringToDateNumber("1902/9/02"), 976);
1291+  assertEquals(TypeConverter.stringToDateNumber("1902/9/2"), 976);
1292+  assertEquals(TypeConverter.stringToDateNumber("4243/11/3"), 856071);
1293+  assertEquals(TypeConverter.stringToDateNumber("  1992/04/19  "), 33713);
1294+  assertEquals(TypeConverter.stringToDateNumber("  1992 /  04/ 19  "), 33713);
1295+  assertEquals(TypeConverter.stringToDateNumber("1992/5/20"), 33744);
1296+  assertEquals(TypeConverter.stringToDateNumber("1992/6/21"), 33776);
1297+  assertEquals(TypeConverter.stringToDateNumber("1992/9/29"), 33876);
1298+  assertEquals(TypeConverter.stringToDateNumber("1992/1/24"), 33627);
1299+  assertEquals(TypeConverter.stringToDateNumber("1992/12/21"), 33959);
1300+  assertEquals(TypeConverter.stringToDateNumber("1992/01/31"), 33634);
1301+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13"), 33616);
1302+  assertEquals(TypeConverter.stringToDateNumber("2004/2/29"), 38046);
1303+  assertEquals(TypeConverter.stringToDateNumber("2004/2/28"), 38045);
1304+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13"), 36173);
1305+  assertEquals(TypeConverter.stringToDateNumber("1999/01/13"), 36173);
1306+  assertEquals(TypeConverter.stringToDateNumber("0999/01/13"), -329069);
1307+  assertEquals(TypeConverter.stringToDateNumber("1200/01/13"), -255656);
1308+  assertEquals(TypeConverter.stringToDateNumber("0029/01/13"), 47131);
1309+  assertEquals(TypeConverter.stringToDateNumber("0030/01/13"), 10971);
1310+  assertEquals(TypeConverter.stringToDateNumber("0044/01/13"), 16084);
1311+  assertEquals(TypeConverter.stringToDateNumber("0050/01/13"), 18276);
1312+  assertEquals(TypeConverter.stringToDateNumber("0097/01/13"), 35443);
1313+  assertEquals(TypeConverter.stringToDateNumber("0099/01/13"), 36173);
1314+  assertEquals(TypeConverter.stringToDateNumber("0000/01/13"), 36538);
1315+  assertEquals(TypeConverter.stringToDateNumber("0101/01/13"), -657057);
1316+  assertEquals(TypeConverter.stringToDateNumber("0100/01/13"), -657422);
1317+  assertEquals(TypeConverter.stringToDateNumber("100/12/31"), -657070);
1318+  assertEquals(TypeConverter.stringToDateNumber("122/11/10"), -649086);
1319+  assertEquals(TypeConverter.stringToDateNumber("2222/1/22"), 117631);
1320+  assertEquals(TypeConverter.stringToDateNumber("222/1/22"), -612854);
1321+  assertEquals(TypeConverter.stringToDateNumber("Sunday 1992/6/24"), 33779);
1322+  assertEquals(TypeConverter.stringToDateNumber("Monday 1992/6/24"), 33779);
1323+  assertEquals(TypeConverter.stringToDateNumber("Tuesday 1992/6/24"), 33779);
1324+  assertEquals(TypeConverter.stringToDateNumber("Wednesday 1992/6/24"), 33779);
1325+  assertEquals(TypeConverter.stringToDateNumber("Thursday 1992/6/24"), 33779);
1326+  assertEquals(TypeConverter.stringToDateNumber("Friday 1992/6/24"), 33779);
1327+  assertEquals(TypeConverter.stringToDateNumber("Saturday 1992/6/24"), 33779);
1328+  assertEquals(TypeConverter.stringToDateNumber("Sun 1992/6/24"), 33779);
1329+  assertEquals(TypeConverter.stringToDateNumber("Mon 1992/6/24"), 33779);
1330+  assertEquals(TypeConverter.stringToDateNumber("Tue 1992/6/24"), 33779);
1331+  assertEquals(TypeConverter.stringToDateNumber("Wed 1992/6/24"), 33779);
1332+  assertEquals(TypeConverter.stringToDateNumber("Thu 1992/6/24"), 33779);
1333+  assertEquals(TypeConverter.stringToDateNumber("Fri 1992/6/24"), 33779);
1334+  assertEquals(TypeConverter.stringToDateNumber("Sat 1992/6/24"), 33779);
1335+  assertEquals(TypeConverter.stringToDateNumber("Sunday, 1992/6/24"), 33779);
1336+  // delimiter tests
1337+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24"), 33779);
1338+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24"), 33779);
1339+  assertEquals(TypeConverter.stringToDateNumber("1992 6 24"), 33779);
1340+  assertEquals(TypeConverter.stringToDateNumber("1992 6 24"), 33779);
1341+  assertEquals(TypeConverter.stringToDateNumber("1992 . 6 . 24"), 33779);
1342+  assertEquals(TypeConverter.stringToDateNumber("1992 / 6 / 24"), 33779);
1343+  assertEquals(TypeConverter.stringToDateNumber("1992, 6, 24"), 33779);
1344+  // flex delimiter should not allow a comma without a space after it.
1345+  catchAndAssertEquals(function() {
1346+    TypeConverter.stringToDateNumber("Sunday,1992/6/24");
1347+  }, VALUE_ERROR);
1348+  // Leap day on non-leap years
1349+  catchAndAssertEquals(function() {
1350+    TypeConverter.stringToDateNumber("2005/2/29");
1351+  }, VALUE_ERROR);
1352+  catchAndAssertEquals(function() {
1353+    TypeConverter.stringToDateNumber("2001/2/29");
1354+  }, VALUE_ERROR);
1355+  // Out of range day for any month
1356+  catchAndAssertEquals(function() {
1357+    TypeConverter.stringToDateNumber("2005/1/44");
1358+  }, VALUE_ERROR);
1359+  // timestamp test
1360+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10am"), 33779);
1361+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10:10"), 33779);
1362+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10:10am"), 33779);
1363+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10:10:10"), 33779);
1364+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10:10:10am"), 33779);
1365+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24  10  am"), 33779);
1366+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10: 10 "), 33779);
1367+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10: 10 pm"), 33779);
1368+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24 10: 10: 10"), 33779);
1369+  assertEquals(TypeConverter.stringToDateNumber("1992-6-24  10: 10: 10    am   "), 33779);
1370+  assertEquals(TypeConverter.stringToDateNumber("1992/6/24 00am"), 33779);
1371+  assertEquals(TypeConverter.stringToDateNumber("1992/06/24 01am "), 33779);
1372+  assertEquals(TypeConverter.stringToDateNumber("1999/1/01 02pm"), 36161);
1373+  assertEquals(TypeConverter.stringToDateNumber("2222/1/01 03pm"), 117610);
1374+  assertEquals(TypeConverter.stringToDateNumber("1902/9/02 12pm"), 976);
1375+  assertEquals(TypeConverter.stringToDateNumber("1902/9/2 12pm"), 976);
1376+  assertEquals(TypeConverter.stringToDateNumber("4243/11/3 12pm   "), 856071);
1377+  assertEquals(TypeConverter.stringToDateNumber("  1992/04/19   12pm   "), 33713);
1378+  assertEquals(TypeConverter.stringToDateNumber("1992/5/20 01am"), 33744);
1379+  assertEquals(TypeConverter.stringToDateNumber("1992/6/21  3pm"), 33776);
1380+  assertEquals(TypeConverter.stringToDateNumber("1992/9/29 3pm"), 33876);
1381+  assertEquals(TypeConverter.stringToDateNumber("1992/1/24 3pm"), 33627);
1382+  assertEquals(TypeConverter.stringToDateNumber("1992/12/21 3pm"), 33959);
1383+  assertEquals(TypeConverter.stringToDateNumber("1992/01/31 3pm"), 33634);
1384+  assertEquals(TypeConverter.stringToDateNumber("1992/1/13 3pm"), 33616);
1385+  assertEquals(TypeConverter.stringToDateNumber("2004/2/29 3pm"), 38046);
1386+  assertEquals(TypeConverter.stringToDateNumber("2004/2/28  3pm "), 38045);
1387+  assertEquals(TypeConverter.stringToDateNumber("1999/1/13 3pm"), 36173);
1388+  assertEquals(TypeConverter.stringToDateNumber("1999/01/13 3pm"), 36173);
1389+  assertEquals(TypeConverter.stringToDateNumber("0999/01/13 3pm"), -329069);
1390+  assertEquals(TypeConverter.stringToDateNumber("1200/01/13 3pm"), -255656);
1391+  assertEquals(TypeConverter.stringToDateNumber("0029/01/13 3pm"), 47131);
1392+  assertEquals(TypeConverter.stringToDateNumber("0030/01/13 3pm"), 10971);
1393+  assertEquals(TypeConverter.stringToDateNumber("0044/01/13 3pm"), 16084);
1394+  assertEquals(TypeConverter.stringToDateNumber("0050/01/13 3pm"), 18276);
1395+  assertEquals(TypeConverter.stringToDateNumber("0097/01/13 00pm"), 35443);
1396+  assertEquals(TypeConverter.stringToDateNumber("0099/01/13 3pm"), 36173);
1397+  assertEquals(TypeConverter.stringToDateNumber("0000/01/13 3pm"), 36538);
1398+  assertEquals(TypeConverter.stringToDateNumber("0101/01/13 3pm"), -657057);
1399+  assertEquals(TypeConverter.stringToDateNumber("0100/01/13 3pm"), -657422);
1400+  assertEquals(TypeConverter.stringToDateNumber("100/12/31 3pm"), -657070);
1401+  assertEquals(TypeConverter.stringToDateNumber("122/11/10 3pm"), -649086);
1402+  assertEquals(TypeConverter.stringToDateNumber("2222/1/22 3pm"), 117631);
1403+  assertEquals(TypeConverter.stringToDateNumber("222/1/22 3pm"), -612854);
1404+  catchAndAssertEquals(function() {
1405+    TypeConverter.stringToDateNumber("2005/2/29 000pm");// Too many digits
1406+  }, VALUE_ERROR);
1407+  catchAndAssertEquals(function() {
1408+    TypeConverter.stringToDateNumber("2001/2/2 13pm");// Hour out of range
1409+  }, VALUE_ERROR);
1410+  // DAY_MONTHNAME_YEAR, DD(fd)Month(fd)YYYY ===========================================================================
1411+  assertEquals(TypeConverter.stringToDateNumber("Sun 09 Feb 2017"), 42775);
1412+  assertEquals(TypeConverter.stringToDateNumber("Sun 9 Feb 2017"), 42775);
1413+  assertEquals(TypeConverter.stringToDateNumber("Mon 09 Feb 2017"), 42775);
1414+  assertEquals(TypeConverter.stringToDateNumber("Thursday 09 Feb 2017"), 42775);
1415+  assertEquals(TypeConverter.stringToDateNumber("Thursday 09 February 2017"), 42775);
1416+  assertEquals(TypeConverter.stringToDateNumber("Sun 01 September 20"), 44075);
1417+  assertEquals(TypeConverter.stringToDateNumber("Sun, 09, Feb, 2017"), 42775);
1418+  assertEquals(TypeConverter.stringToDateNumber("20 May 1992"), 33744);
1419+  assertEquals(TypeConverter.stringToDateNumber("31 December 100"), -657070);
1420+  assertEquals(TypeConverter.stringToDateNumber("13 January 0030"), 10971);
1421+  assertEquals(TypeConverter.stringToDateNumber("13 January 1200"), -255656);
1422+  assertEquals(TypeConverter.stringToDateNumber("22 January 2222"), 117631);
1423+  assertEquals(TypeConverter.stringToDateNumber("3 November 4243"), 856071);
1424+  assertEquals(TypeConverter.stringToDateNumber("13 November 0999"), -328765);
1425+  assertEquals(TypeConverter.stringToDateNumber("13 November 1200"), -255351);
1426+  assertEquals(TypeConverter.stringToDateNumber("13 January 0029"), 47131);
1427+  assertEquals(TypeConverter.stringToDateNumber("13 January 0030"), 10971);
1428+  assertEquals(TypeConverter.stringToDateNumber("13 January 0044"), 16084);
1429+  assertEquals(TypeConverter.stringToDateNumber("13 January 0050"), 18276);
1430+  assertEquals(TypeConverter.stringToDateNumber("13 January 0097"), 35443);
1431+  assertEquals(TypeConverter.stringToDateNumber("13 January 0099"), 36173);
1432+  assertEquals(TypeConverter.stringToDateNumber("13 January 0000"), 36538);
1433+  assertEquals(TypeConverter.stringToDateNumber("13 January 0101"), -657057);
1434+  assertEquals(TypeConverter.stringToDateNumber("13 January 0100"), -657422);
1435+  assertEquals(TypeConverter.stringToDateNumber("01 Jan 2017"), 42736);
1436+  assertEquals(TypeConverter.stringToDateNumber("01 Feb 2017"), 42767);
1437+  assertEquals(TypeConverter.stringToDateNumber("01 Mar 2017"), 42795);
1438+  assertEquals(TypeConverter.stringToDateNumber("01 Apr 2017"), 42826);
1439+  assertEquals(TypeConverter.stringToDateNumber("01 May 2017"), 42856);
1440+  assertEquals(TypeConverter.stringToDateNumber("01 Jun 2017"), 42887);
1441+  assertEquals(TypeConverter.stringToDateNumber("01 Jul 2017"), 42917);
1442+  assertEquals(TypeConverter.stringToDateNumber("01 Aug 2017"), 42948);
1443+  assertEquals(TypeConverter.stringToDateNumber("01 Sep 2017"), 42979);
1444+  assertEquals(TypeConverter.stringToDateNumber("01 Oct 2017"), 43009);
1445+  assertEquals(TypeConverter.stringToDateNumber("01 Nov 2017"), 43040);
1446+  assertEquals(TypeConverter.stringToDateNumber(" 1 Dec 2017"), 43070);
1447+  assertEquals(TypeConverter.stringToDateNumber("20 Jan 2015"), 42024);
1448+  assertEquals(TypeConverter.stringToDateNumber("20 Feb 2015"), 42055);
1449+  assertEquals(TypeConverter.stringToDateNumber("20 Mar 2015"), 42083);
1450+  assertEquals(TypeConverter.stringToDateNumber("20 Apr 2015"), 42114);
1451+  assertEquals(TypeConverter.stringToDateNumber("20 May 2015"), 42144);
1452+  assertEquals(TypeConverter.stringToDateNumber("20 Jun 2015"), 42175);
1453+  assertEquals(TypeConverter.stringToDateNumber("20 Jul 2015"), 42205);
1454+  assertEquals(TypeConverter.stringToDateNumber("20 Aug 2015"), 42236);
1455+  assertEquals(TypeConverter.stringToDateNumber("20 Sep 2015"), 42267);
1456+  assertEquals(TypeConverter.stringToDateNumber("20 Oct 2015"), 42297);
1457+  assertEquals(TypeConverter.stringToDateNumber("20 Nov 2015"), 42328);
1458+  assertEquals(TypeConverter.stringToDateNumber("20 Dec 2015"), 42358);
1459+  assertEquals(TypeConverter.stringToDateNumber("29 Feb 2004"), 38046); // leap year, 29th ok
1460+  catchAndAssertEquals(function() {
1461+    TypeConverter.stringToDateNumber("29 Feb 2001");// not leap year, 29th not ok
1462+  }, VALUE_ERROR);
1463+  catchAndAssertEquals(function() {
1464+    TypeConverter.stringToDateNumber("32 June 2001");// overload numbers not ok
1465+  }, VALUE_ERROR);
1466+  // delimiter tests
1467+  assertEquals(TypeConverter.stringToDateNumber("Sun, 09, Feb, 2017"), 42775);
1468+  assertEquals(TypeConverter.stringToDateNumber("Sun, 09/Feb/2017"), 42775);
1469+  assertEquals(TypeConverter.stringToDateNumber("09/Feb/2017"), 42775);
1470+  assertEquals(TypeConverter.stringToDateNumber("09-Feb-2017"), 42775);
1471+  assertEquals(TypeConverter.stringToDateNumber("09.Feb.2017"), 42775);
1472+  assertEquals(TypeConverter.stringToDateNumber("09 Feb/2017"), 42775);
1473+  assertEquals(TypeConverter.stringToDateNumber("09 . Feb . 2017"), 42775);
1474+  // If the delimiters don't match the first one should be a space.
1475+  catchAndAssertEquals(function() {
1476+    TypeConverter.stringToDateNumber("09.Feb/2017");
1477+  }, VALUE_ERROR);
1478+  // Comma delimiters should be followed by spaces.
1479+  catchAndAssertEquals(function() {
1480+    TypeConverter.stringToDateNumber("09,Feb,2017");
1481+  }, VALUE_ERROR);
1482+  // timestamp tests
1483+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10am"), 33779);
1484+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10:10"), 33779);
1485+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10:10am"), 33779);
1486+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10:10:10"), 33779);
1487+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10:10:10am"), 33779);
1488+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992  10  am"), 33779);
1489+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10: 10 "), 33779);
1490+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10: 10 pm"), 33779);
1491+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992 10: 10: 10"), 33779);
1492+  assertEquals(TypeConverter.stringToDateNumber("24/June/1992  10: 10: 10    am   "), 33779);
1493+  // MONTHNAME_DAY_YEAR, Month(fd)DD(fd)YYYY, 'Aug 19 2020' ============================================================
1494+  assertEquals(TypeConverter.stringToDateNumber("Sun Feb 09 2017"), 42775);
1495+  assertEquals(TypeConverter.stringToDateNumber("Sun Feb 9 2017"), 42775);
1496+  assertEquals(TypeConverter.stringToDateNumber("Mon Feb 09 2017"), 42775);
1497+  assertEquals(TypeConverter.stringToDateNumber("Thursday Feb 09 2017"), 42775);
1498+  assertEquals(TypeConverter.stringToDateNumber("Thursday February 09 2017"), 42775);
1499+  assertEquals(TypeConverter.stringToDateNumber("Sun September 01 20"), 44075);
1500+  assertEquals(TypeConverter.stringToDateNumber("Sun, Feb, 09, 2017"), 42775);
1501+  assertEquals(TypeConverter.stringToDateNumber("May 20 1992"), 33744);
1502+  assertEquals(TypeConverter.stringToDateNumber("December 31 100"), -657070);
1503+  assertEquals(TypeConverter.stringToDateNumber("January 13 0030"), 10971);
1504+  assertEquals(TypeConverter.stringToDateNumber("January 13 1200"), -255656);
1505+  assertEquals(TypeConverter.stringToDateNumber("January 22 2222"), 117631);
1506+  assertEquals(TypeConverter.stringToDateNumber("November 3 4243"), 856071);
1507+  assertEquals(TypeConverter.stringToDateNumber("Feb 29 2004"), 38046); // leap year, 29th ok
1508+  catchAndAssertEquals(function() {
1509+    TypeConverter.stringToDateNumber("Feb 29 2001");// not leap year, 29th not ok
1510+  }, VALUE_ERROR);
1511+  catchAndAssertEquals(function() {
1512+    TypeConverter.stringToDateNumber("June 32 2001");// overload numbers not ok
1513+  }, VALUE_ERROR);
1514+  // YEAR_MONTHDIG, YYYY(fd)MM, '1992/06' ==============================================================================
1515+  assertEquals(TypeConverter.stringToDateNumber("2017/01"), 42736);
1516+  assertEquals(TypeConverter.stringToDateNumber("2017/02"), 42767);
1517+  assertEquals(TypeConverter.stringToDateNumber("2017/03"), 42795);
1518+  assertEquals(TypeConverter.stringToDateNumber("2017/04"), 42826);
1519+  assertEquals(TypeConverter.stringToDateNumber("2017/05"), 42856);
1520+  assertEquals(TypeConverter.stringToDateNumber("2017/06"), 42887);
1521+  assertEquals(TypeConverter.stringToDateNumber("2017/07"), 42917);
1522+  assertEquals(TypeConverter.stringToDateNumber("2017/08"), 42948);
1523+  assertEquals(TypeConverter.stringToDateNumber("2017/09"), 42979);
1524+  assertEquals(TypeConverter.stringToDateNumber("2017/10"), 43009);
1525+  assertEquals(TypeConverter.stringToDateNumber("2017/11"), 43040);
1526+  assertEquals(TypeConverter.stringToDateNumber("2017/12"), 43070);
1527+  assertEquals(TypeConverter.stringToDateNumber("2017/01"), 42736);
1528+  // delimiter tests
1529+  assertEquals(TypeConverter.stringToDateNumber("Thursday 2017/01"), 42736);
1530+  assertEquals(TypeConverter.stringToDateNumber("Thursday, 2017/01"), 42736);
1531+  assertEquals(TypeConverter.stringToDateNumber("2017/01"), 42736);
1532+  assertEquals(TypeConverter.stringToDateNumber("2017-01"), 42736);
1533+  assertEquals(TypeConverter.stringToDateNumber("2017. 01"), 42736);
1534+  assertEquals(TypeConverter.stringToDateNumber("2017 01"), 42736);
1535+  assertEquals(TypeConverter.stringToDateNumber("2017, 01"), 42736);
1536+  // Comma and period delimiters should be followed by spaces.
1537+  catchAndAssertEquals(function() {
1538+    TypeConverter.stringToDateNumber("2017,01");
1539+  }, VALUE_ERROR);
1540+  catchAndAssertEquals(function() {
1541+    TypeConverter.stringToDateNumber("2017.01");
1542+  }, VALUE_ERROR);
1543+  // timestamp test
1544+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10am"), 42736);
1545+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10:10"), 42736);
1546+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10:10am"), 42736);
1547+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10:10:10"), 42736);
1548+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10:10:10am"), 42736);
1549+  assertEquals(TypeConverter.stringToDateNumber("2017-01  10  am"), 42736);
1550+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10: 10 "), 42736);
1551+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10: 10 pm"), 42736);
1552+  assertEquals(TypeConverter.stringToDateNumber("2017-01 10: 10: 10"), 42736);
1553+  assertEquals(TypeConverter.stringToDateNumber("2017-01  10: 10: 10    am   "), 42736);
1554+  // MONTHDIG_YEAR, MM(fd)YYYY, '06/1992' ================================================================================
1555+  assertEquals(TypeConverter.stringToDateNumber("01/2017"), 42736);
1556+  assertEquals(TypeConverter.stringToDateNumber("02/2017"), 42767);
1557+  assertEquals(TypeConverter.stringToDateNumber("03/2017"), 42795);
1558+  assertEquals(TypeConverter.stringToDateNumber("04/2017"), 42826);
1559+  assertEquals(TypeConverter.stringToDateNumber("05/2017"), 42856);
1560+  assertEquals(TypeConverter.stringToDateNumber("06/2017"), 42887);
1561+  assertEquals(TypeConverter.stringToDateNumber("07/2017"), 42917);
1562+  assertEquals(TypeConverter.stringToDateNumber("08/2017"), 42948);
1563+  assertEquals(TypeConverter.stringToDateNumber("09/2017"), 42979);
1564+  assertEquals(TypeConverter.stringToDateNumber("10/2017"), 43009);
1565+  assertEquals(TypeConverter.stringToDateNumber("11/2017"), 43040);
1566+  assertEquals(TypeConverter.stringToDateNumber("12/2017"), 43070);
1567+  // delimiter tests
1568+  assertEquals(TypeConverter.stringToDateNumber("Thursday 01/2017"), 42736);
1569+  assertEquals(TypeConverter.stringToDateNumber("Thursday, 01/2017"), 42736);
1570+  assertEquals(TypeConverter.stringToDateNumber("1/2017"), 42736);
1571+  assertEquals(TypeConverter.stringToDateNumber("01-2017"), 42736);
1572+  assertEquals(TypeConverter.stringToDateNumber("01. 2017"), 42736);
1573+  assertEquals(TypeConverter.stringToDateNumber("01, 2017"), 42736);
1574+  // Comma, period delimiters should be followed by spaces.
1575+  catchAndAssertEquals(function() {
1576+    TypeConverter.stringToDateNumber("01,2017");
1577+  }, VALUE_ERROR);
1578+  catchAndAssertEquals(function() {
1579+    TypeConverter.stringToDateNumber("01.2017");
1580+  }, VALUE_ERROR);
1581+  // 0 is not a month
1582+  catchAndAssertEquals(function() {
1583+    TypeConverter.stringToDateNumber("0/2017");
1584+  }, VALUE_ERROR);
1585+  // timestamp test
1586+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10am"), 42736);
1587+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10:10"), 42736);
1588+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10:10am"), 42736);
1589+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10:10:10"), 42736);
1590+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10:10:10am"), 42736);
1591+  assertEquals(TypeConverter.stringToDateNumber("01-2017  10  am"), 42736);
1592+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10: 10 "), 42736);
1593+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10: 10 pm"), 42736);
1594+  assertEquals(TypeConverter.stringToDateNumber("01-2017 10: 10: 10"), 42736);
1595+  assertEquals(TypeConverter.stringToDateNumber("01-2017  10: 10: 10    am   "), 42736);
1596+  // YEAR_MONTHNAME, YYYY(fd)Month, '1992/Aug' =========================================================================
1597+  assertEquals(TypeConverter.stringToDateNumber("2017 January"), 42736);
1598+  assertEquals(TypeConverter.stringToDateNumber("2017 February"), 42767);
1599+  assertEquals(TypeConverter.stringToDateNumber("2017 March"), 42795);
1600+  assertEquals(TypeConverter.stringToDateNumber("2017 April"), 42826);
1601+  assertEquals(TypeConverter.stringToDateNumber("2017 May"), 42856);
1602+  assertEquals(TypeConverter.stringToDateNumber("2017 June"), 42887);
1603+  assertEquals(TypeConverter.stringToDateNumber("2017 July"), 42917);
1604+  assertEquals(TypeConverter.stringToDateNumber("2017 August"), 42948);
1605+  assertEquals(TypeConverter.stringToDateNumber("2017 September"), 42979);
1606+  assertEquals(TypeConverter.stringToDateNumber("2017 October"), 43009);
1607+  assertEquals(TypeConverter.stringToDateNumber("2017 November"), 43040);
1608+  assertEquals(TypeConverter.stringToDateNumber("2017 December"), 43070);
1609+  // delimiter tests
1610+  assertEquals(TypeConverter.stringToDateNumber("Thursday 2017 January"), 42736);
1611+  assertEquals(TypeConverter.stringToDateNumber("Thursday, 2017 January"), 42736);
1612+  assertEquals(TypeConverter.stringToDateNumber("2017/January"), 42736);
1613+  assertEquals(TypeConverter.stringToDateNumber("2017-January"), 42736);
1614+  assertEquals(TypeConverter.stringToDateNumber("2017. January"), 42736);
1615+  assertEquals(TypeConverter.stringToDateNumber("2017, January"), 42736);
1616+  // Comma delimiters should be followed by spaces.
1617+  catchAndAssertEquals(function() {
1618+    TypeConverter.stringToDateNumber("2017,January");
1619+  }, VALUE_ERROR);
1620+  catchAndAssertEquals(function() {
1621+    TypeConverter.stringToDateNumber("2017.January");
1622+  }, VALUE_ERROR);
1623+  // timestamp test
1624+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10am"), 42736);
1625+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10:10"), 42736);
1626+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10:10am"), 42736);
1627+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10:10:10"), 42736);
1628+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10:10:10am"), 42736);
1629+  assertEquals(TypeConverter.stringToDateNumber("2017-January  10  am"), 42736);
1630+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10: 10 "), 42736);
1631+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10: 10 pm"), 42736);
1632+  assertEquals(TypeConverter.stringToDateNumber("2017-January 10: 10: 10"), 42736);
1633+  assertEquals(TypeConverter.stringToDateNumber("2017-January  10: 10: 10    am   "), 42736);
1634+  // MONTHNAME_YEAR, Month(fd)YYYY, 'Aug 1992' =========================================================================
1635+  assertEquals(TypeConverter.stringToDateNumber("January 2017"), 42736);
1636+  assertEquals(TypeConverter.stringToDateNumber("February 2017"), 42767);
1637+  assertEquals(TypeConverter.stringToDateNumber("March 2017"), 42795);
1638+  assertEquals(TypeConverter.stringToDateNumber("April 2017"), 42826);
1639+  assertEquals(TypeConverter.stringToDateNumber("May 2017"), 42856);
1640+  assertEquals(TypeConverter.stringToDateNumber("June 2017"), 42887);
1641+  assertEquals(TypeConverter.stringToDateNumber("July 2017"), 42917);
1642+  assertEquals(TypeConverter.stringToDateNumber("August 2017"), 42948);
1643+  assertEquals(TypeConverter.stringToDateNumber("September 2017"), 42979);
1644+  assertEquals(TypeConverter.stringToDateNumber("October 2017"), 43009);
1645+  assertEquals(TypeConverter.stringToDateNumber("November 2017"), 43040);
1646+  assertEquals(TypeConverter.stringToDateNumber("December 2017"), 43070);
1647+  assertEquals(TypeConverter.stringToDateNumber("  Feb    2017  "), 42767);
1648+  assertEquals(TypeConverter.stringToDateNumber("Feb-2017"), 42767);
1649+  assertEquals(TypeConverter.stringToDateNumber("Feb. 2017"), 42767);
1650+  assertEquals(TypeConverter.stringToDateNumber("Feb/2017"), 42767);
1651+  assertEquals(TypeConverter.stringToDateNumber("Feb    .    2017"), 42767);
1652+  assertEquals(TypeConverter.stringToDateNumber("Feb -      2017"), 42767);
1653+  assertEquals(TypeConverter.stringToDateNumber("January 0030"), 10959);
1654+  assertEquals(TypeConverter.stringToDateNumber("November 4243"), 856069);
1655+  assertEquals(TypeConverter.stringToDateNumber("December 0100"), -657100);
1656+  assertEquals(TypeConverter.stringToDateNumber("Jan 2017"), 42736);
1657+  assertEquals(TypeConverter.stringToDateNumber("Feb 2017"), 42767);
1658+  assertEquals(TypeConverter.stringToDateNumber("Mar 2017"), 42795);
1659+  assertEquals(TypeConverter.stringToDateNumber("Apr 2017"), 42826);
1660+  assertEquals(TypeConverter.stringToDateNumber("May 2017"), 42856);
1661+  assertEquals(TypeConverter.stringToDateNumber("Jun 2017"), 42887);
1662+  assertEquals(TypeConverter.stringToDateNumber("Jul 2017"), 42917);
1663+  assertEquals(TypeConverter.stringToDateNumber("Aug 2017"), 42948);
1664+  assertEquals(TypeConverter.stringToDateNumber("Sep 2017"), 42979);
1665+  assertEquals(TypeConverter.stringToDateNumber("Oct 2017"), 43009);
1666+  assertEquals(TypeConverter.stringToDateNumber("Nov 2017"), 43040);
1667+  assertEquals(TypeConverter.stringToDateNumber("Dec 2017"), 43070);
1668+  assertEquals(TypeConverter.stringToDateNumber("Feb, 2017"), 42767);
1669+  catchAndAssertEquals(function() {
1670+    TypeConverter.stringToDateNumber("December 100");// need 4 digits
1671+  }, VALUE_ERROR);
1672+  catchAndAssertEquals(function() {
1673+    TypeConverter.stringToDateNumber("Dec.20");// need space after if using period
1674+  }, VALUE_ERROR);
1675+  // delimiter tests
1676+  assertEquals(TypeConverter.stringToDateNumber("Thursday January 2017"), 42736);
1677+  assertEquals(TypeConverter.stringToDateNumber("Thursday, January 2017"), 42736);
1678+  assertEquals(TypeConverter.stringToDateNumber("January/2017"), 42736);
1679+  assertEquals(TypeConverter.stringToDateNumber("January-2017"), 42736);
1680+  assertEquals(TypeConverter.stringToDateNumber("January. 2017"), 42736);
1681+  assertEquals(TypeConverter.stringToDateNumber("January, 2017"), 42736);
1682+  // Comma, period delimiters should be followed by spaces.
1683+  catchAndAssertEquals(function() {
1684+    TypeConverter.stringToDateNumber("January,2017");
1685+  }, VALUE_ERROR);
1686+  catchAndAssertEquals(function() {
1687+    TypeConverter.stringToDateNumber("January.2017");
1688+  }, VALUE_ERROR);
1689+  // timestamp test
1690+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10am"), 42736);
1691+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10:10"), 42736);
1692+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10:10am"), 42736);
1693+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10:10:10"), 42736);
1694+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10:10:10am"), 42736);
1695+  assertEquals(TypeConverter.stringToDateNumber("January-2017  10  am"), 42736);
1696+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10: 10 "), 42736);
1697+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10: 10 pm"), 42736);
1698+  assertEquals(TypeConverter.stringToDateNumber("January-2017 10: 10: 10"), 42736);
1699+  assertEquals(TypeConverter.stringToDateNumber("January-2017  10: 10: 10    am  "), 42736);
1700+});
1701+
1702+
1703+test("TypeConverter.stringToTimeNumber", function () {
1704+  assertEquals(TypeConverter.stringToTimeNumber("12:00pm"), 0.5);
1705+  assertEquals(TypeConverter.stringToTimeNumber("12:00"), 0.5);
1706+  assertEquals(TypeConverter.stringToTimeNumber("12pm"), 0.5);
1707+  assertEquals(TypeConverter.stringToTimeNumber("10:10am"), 0.4236111111111111);
1708+  assertEquals(TypeConverter.stringToTimeNumber("10:10:10am"), 0.4237268518518518);
1709+  assertEquals(TypeConverter.stringToTimeNumber("22:10:10"), 0.9237268518518519);
1710+  assertEquals(TypeConverter.stringToTimeNumber("1:10:10"), 0.048726851851851855);
1711+  assertEquals(TypeConverter.stringToTimeNumber("25:10:10"), 0.048726851851851855);
1712+});
1713\ No newline at end of file