avm2: Strings passed to date constructor should be parsed
This commit is contained in:
parent
ab3a1e6148
commit
a51ffd0e9f
|
@ -274,7 +274,11 @@ pub fn instance_init<'gc>(
|
||||||
.map_year(|year| if year < 100.0 { year + 1900.0 } else { year })
|
.map_year(|year| if year < 100.0 { year + 1900.0 } else { year })
|
||||||
.apply(date);
|
.apply(date);
|
||||||
} else {
|
} else {
|
||||||
let timestamp = timestamp.coerce_to_number(activation)?;
|
let timestamp = if let Value::String(date_str) = timestamp {
|
||||||
|
parse_full_date(activation, *date_str).unwrap_or(f64::NAN)
|
||||||
|
} else {
|
||||||
|
timestamp.coerce_to_number(activation)?
|
||||||
|
};
|
||||||
if timestamp.is_finite() {
|
if timestamp.is_finite() {
|
||||||
if let LocalResult::Single(time) =
|
if let LocalResult::Single(time) =
|
||||||
Utc.timestamp_millis_opt(timestamp as i64)
|
Utc.timestamp_millis_opt(timestamp as i64)
|
||||||
|
|
Loading…
Reference in New Issue