mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-09 09:00:46 +00:00
LibJS: Replace a DeprecatedString with String
Refactors Date class to use String instead of DeprecatedString. Changes use of the Date class in DatePrototype accordingly.
This commit is contained in:
parent
65a927d16e
commit
7c66c5f12d
|
@ -34,7 +34,7 @@ Date::Date(double date_value, Object& prototype)
|
|||
{
|
||||
}
|
||||
|
||||
DeprecatedString Date::iso_date_string() const
|
||||
ErrorOr<String> Date::iso_date_string() const
|
||||
{
|
||||
int year = year_from_time(m_date_value);
|
||||
|
||||
|
@ -59,7 +59,7 @@ DeprecatedString Date::iso_date_string() const
|
|||
builder.appendff("{:03}", ms_from_time(m_date_value));
|
||||
builder.append('Z');
|
||||
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
// DayWithinYear(t), https://tc39.es/ecma262/#eqn-DayWithinYear
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
double date_value() const { return m_date_value; }
|
||||
void set_date_value(double value) { m_date_value = value; }
|
||||
|
||||
DeprecatedString iso_date_string() const;
|
||||
ErrorOr<String> iso_date_string() const;
|
||||
|
||||
private:
|
||||
Date(double date_value, Object& prototype);
|
||||
|
|
|
@ -967,7 +967,7 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_iso_string)
|
|||
if (!Value(this_object->date_value()).is_finite_number())
|
||||
return vm.throw_completion<RangeError>(ErrorType::InvalidTimeValue);
|
||||
|
||||
auto string = this_object->iso_date_string();
|
||||
auto string = TRY_OR_THROW_OOM(vm, this_object->iso_date_string());
|
||||
return PrimitiveString::create(vm, move(string));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user