X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fjs%2FJSDate.java;h=ca9c5b7ce12ccd5b716b02bddae4bc7e924f38e9;hb=6261c41b2ac9d182d8c3541e8e0e5fd00062fa43;hp=345e3d4c703c7775375b86bcca6a6612fad076b9;hpb=c2a138c3882a4bd8dce0212ac59765af5cb126c6;p=org.ibex.core.git diff --git a/src/org/xwt/js/JSDate.java b/src/org/xwt/js/JSDate.java index 345e3d4..ca9c5b7 100644 --- a/src/org/xwt/js/JSDate.java +++ b/src/org/xwt/js/JSDate.java @@ -61,7 +61,7 @@ public class JSDate extends JS { public String coerceToString() { return date_format(date, FORMATSPEC_FULL); } - public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) { + public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn { switch(nargs) { case 0: { //#switch(method) @@ -126,7 +126,7 @@ public class JSDate extends JS { return super.callMethod(method, a0, a1, a2, rest, nargs); } - public Object get(Object key) { + public Object get(Object key) throws JSExn { //#switch(key) case "toString": return METHOD; case "toTimeString": return METHOD; @@ -896,71 +896,62 @@ public class JSDate extends JS { private static double _toNumber(Object[] o, int index) { return JS.toDouble(o[index]); } private static double toDouble(double d) { return d; } - // FIXME: switch to new calling convention here - public JSDate(JSArray args_) { - Object[] args = new Object[args_.length()]; - for(int i=0; i= 2) array[2] = toDouble(a2); + for(int i=0; i= 0 && array[0] <= 99) + array[0] += 1900; + + /* if we got a 0 for 'date' (which is out of range) + * pretend it's a 1 */ + if (array[2] < 1) + array[2] = 1; + + double day = MakeDay(array[0], array[1], array[2]); + double time = MakeTime(array[3], array[4], array[5], array[6]); + time = MakeDate(day, time); + time = internalUTC(time); + obj.date = TimeClip(time); + + return; } } - - /* adjust 2-digit years into the 20th century */ - if (array[0] >= 0 && array[0] <= 99) - array[0] += 1900; - - /* if we got a 0 for 'date' (which is out of range) - * pretend it's a 1 */ - if (array[2] < 1) - array[2] = 1; - - double day = MakeDay(array[0], array[1], array[2]); - double time = MakeTime(array[3], array[4], array[5], array[6]); - time = MakeDate(day, time); - time = internalUTC(time); - obj.date = TimeClip(time); - - return; } /* constants for toString, toUTCString */