mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 03:05:34 +00:00
Fix to 61183. Detect whether the OS has given us a date string ending in /xx (as in xx/xx/xx) for Date.prototype.toLocale[Date]String, and pad it out to the real number of digits.
r=rogerl
This commit is contained in:
parent
bdef0461a0
commit
51e20d88e5
@ -1630,6 +1630,14 @@ date_toLocaleHelper(JSContext *cx, JSObject *obj, uintN argc,
|
||||
/* If it failed, default to toString. */
|
||||
if (result_len == 0)
|
||||
return date_format(cx, *date, FORMATSPEC_FULL, rval);
|
||||
|
||||
/* Hacked check against undesired 2-digit year 00/00/00 form. */
|
||||
if (buf[result_len - 3] == '/' &&
|
||||
isdigit(buf[result_len - 2]) && isdigit(buf[result_len - 1])) {
|
||||
JS_snprintf(buf + (result_len - 2), (sizeof buf) - (result_len - 2),
|
||||
"%d", js_DateGetYear(cx, obj));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
str = JS_NewStringCopyZ(cx, buf);
|
||||
|
Loading…
Reference in New Issue
Block a user