ECMA mandates a ToPrimitive on Date constructor arguments that we didn't have.

This commit is contained in:
nboyd%atg.com 2001-01-25 19:56:54 +00:00
Родитель 552c1ec950
Коммит 16564bcb92
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -844,11 +844,13 @@ public class NativeDate extends ScriptableObject {
// if called with just one arg -
if (args.length == 1) {
double date;
// if it's not a string, use it as a millisecond date
if (args[0] instanceof Scriptable)
args[0] = ((Scriptable) args[0]).getDefaultValue(null);
if (!(args[0] instanceof String)) {
// if it's not a string, use it as a millisecond date
date = ScriptRuntime.toNumber(args[0]);
} else {
// it's a string; parse it.
// it's a string; parse it.
String str = (String) args[0];
date = date_parseString(str);
}

Просмотреть файл

@ -844,11 +844,13 @@ public class NativeDate extends ScriptableObject {
// if called with just one arg -
if (args.length == 1) {
double date;
// if it's not a string, use it as a millisecond date
if (args[0] instanceof Scriptable)
args[0] = ((Scriptable) args[0]).getDefaultValue(null);
if (!(args[0] instanceof String)) {
// if it's not a string, use it as a millisecond date
date = ScriptRuntime.toNumber(args[0]);
} else {
// it's a string; parse it.
// it's a string; parse it.
String str = (String) args[0];
date = date_parseString(str);
}