diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 8b8b44449f6a..4456040d56b8 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -2655,135 +2655,6 @@ js_DateGetSeconds(JSContext *cx, JSObject* obj) return (int) SecFromTime(utctime); } -JS_FRIEND_API(void) -js_DateSetYear(JSContext *cx, JSObject *obj, int year) -{ - jsdouble local; - - if (!GetAndCacheLocalTime(cx, obj, NULL, &local)) - return; - - /* reset date if it was NaN */ - if (JSDOUBLE_IS_NaN(local)) - local = 0; - - local = date_msecFromDate(year, - MonthFromTime(local), - DateFromTime(local), - HourFromTime(local), - MinFromTime(local), - SecFromTime(local), - msFromTime(local)); - - /* SetUTCTime also invalidates local time cache. */ - SetUTCTime(cx, obj, UTC(local, cx)); -} - -JS_FRIEND_API(void) -js_DateSetMonth(JSContext *cx, JSObject *obj, int month) -{ - jsdouble local; - - JS_ASSERT(month < 12); - - if (!GetAndCacheLocalTime(cx, obj, NULL, &local)) - return; - - /* bail if date was NaN */ - if (JSDOUBLE_IS_NaN(local)) - return; - - local = date_msecFromDate(YearFromTime(local), - month, - DateFromTime(local), - HourFromTime(local), - MinFromTime(local), - SecFromTime(local), - msFromTime(local)); - SetUTCTime(cx, obj, UTC(local, cx)); -} - -JS_FRIEND_API(void) -js_DateSetDate(JSContext *cx, JSObject *obj, int date) -{ - jsdouble local; - - if (!GetAndCacheLocalTime(cx, obj, NULL, &local)) - return; - - if (JSDOUBLE_IS_NaN(local)) - return; - - local = date_msecFromDate(YearFromTime(local), - MonthFromTime(local), - date, - HourFromTime(local), - MinFromTime(local), - SecFromTime(local), - msFromTime(local)); - SetUTCTime(cx, obj, UTC(local, cx)); -} - -JS_FRIEND_API(void) -js_DateSetHours(JSContext *cx, JSObject *obj, int hours) -{ - jsdouble local; - - if (!GetAndCacheLocalTime(cx, obj, NULL, &local)) - return; - - if (JSDOUBLE_IS_NaN(local)) - return; - local = date_msecFromDate(YearFromTime(local), - MonthFromTime(local), - DateFromTime(local), - hours, - MinFromTime(local), - SecFromTime(local), - msFromTime(local)); - SetUTCTime(cx, obj, UTC(local, cx)); -} - -JS_FRIEND_API(void) -js_DateSetMinutes(JSContext *cx, JSObject *obj, int minutes) -{ - jsdouble local; - - if (!GetAndCacheLocalTime(cx, obj, NULL, &local)) - return; - - if (JSDOUBLE_IS_NaN(local)) - return; - local = date_msecFromDate(YearFromTime(local), - MonthFromTime(local), - DateFromTime(local), - HourFromTime(local), - minutes, - SecFromTime(local), - msFromTime(local)); - SetUTCTime(cx, obj, UTC(local, cx)); -} - -JS_FRIEND_API(void) -js_DateSetSeconds(JSContext *cx, JSObject *obj, int seconds) -{ - jsdouble local; - - if (!GetAndCacheLocalTime(cx, obj, NULL, &local)) - return; - - if (JSDOUBLE_IS_NaN(local)) - return; - local = date_msecFromDate(YearFromTime(local), - MonthFromTime(local), - DateFromTime(local), - HourFromTime(local), - MinFromTime(local), - seconds, - msFromTime(local)); - SetUTCTime(cx, obj, UTC(local, cx)); -} - JS_FRIEND_API(jsdouble) js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj) { diff --git a/js/src/jsdate.h b/js/src/jsdate.h index 8dd7d783348e..ba97ddd855c4 100644 --- a/js/src/jsdate.h +++ b/js/src/jsdate.h @@ -79,7 +79,7 @@ js_NewDateObjectMsec(JSContext* cx, jsdouble msec_time); * * Assert that mon < 12 to help catch off-by-one user errors, which are common * due to the 0-based month numbering copied into JS from Java (java.util.Date - * in 1995). js_DateSetMonth (below) likewise asserts month < 12. + * in 1995). */ extern JS_FRIEND_API(JSObject*) js_NewDateObject(JSContext* cx, int year, int mon, int mday, @@ -110,24 +110,6 @@ js_DateGetMinutes(JSContext *cx, JSObject* obj); extern JS_FRIEND_API(int) js_DateGetSeconds(JSContext *cx, JSObject* obj); -extern JS_FRIEND_API(void) -js_DateSetYear(JSContext *cx, JSObject *obj, int year); - -extern JS_FRIEND_API(void) -js_DateSetMonth(JSContext *cx, JSObject *obj, int month); - -extern JS_FRIEND_API(void) -js_DateSetDate(JSContext *cx, JSObject *obj, int date); - -extern JS_FRIEND_API(void) -js_DateSetHours(JSContext *cx, JSObject *obj, int hours); - -extern JS_FRIEND_API(void) -js_DateSetMinutes(JSContext *cx, JSObject *obj, int minutes); - -extern JS_FRIEND_API(void) -js_DateSetSeconds(JSContext *cx, JSObject *obj, int seconds); - extern JS_FRIEND_API(jsdouble) js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj);