mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:17:34 +00:00
LibJS: Port temporal_time_to_string() to String
This commit is contained in:
parent
b6e13f451f
commit
cfb4b44691
2 changed files with 3 additions and 3 deletions
|
@ -441,7 +441,7 @@ ThrowCompletionOr<TemporalTimeLikeRecord> to_temporal_time_record(VM& vm, Object
|
|||
}
|
||||
|
||||
// 4.5.9 TemporalTimeToString ( hour, minute, second, millisecond, microsecond, nanosecond, precision ), https://tc39.es/proposal-temporal/#sec-temporal-temporaltimetostring
|
||||
ThrowCompletionOr<DeprecatedString> temporal_time_to_string(VM& vm, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond, Variant<StringView, u8> const& precision)
|
||||
ThrowCompletionOr<String> temporal_time_to_string(VM& vm, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond, Variant<StringView, u8> const& precision)
|
||||
{
|
||||
// 1. Assert: hour, minute, second, millisecond, microsecond and nanosecond are integers.
|
||||
|
||||
|
@ -452,7 +452,7 @@ ThrowCompletionOr<DeprecatedString> temporal_time_to_string(VM& vm, u8 hour, u8
|
|||
auto seconds = MUST_OR_THROW_OOM(format_seconds_string_part(vm, second, millisecond, microsecond, nanosecond, precision));
|
||||
|
||||
// 5. Return the string-concatenation of hour, the code unit 0x003A (COLON), minute, and seconds.
|
||||
return DeprecatedString::formatted("{:02}:{:02}{}", hour, minute, seconds);
|
||||
return TRY_OR_THROW_OOM(vm, String::formatted("{:02}:{:02}{}", hour, minute, seconds));
|
||||
}
|
||||
|
||||
// 4.5.10 CompareTemporalTime ( h1, min1, s1, ms1, mus1, ns1, h2, min2, s2, ms2, mus2, ns2 ), https://tc39.es/proposal-temporal/#sec-temporal-comparetemporaltime
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue