mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 08:22:55 +00:00
LibWeb: Preserve unit when serializing time values
Previously, when serializing a time value, we would always convert it to seconds. We now canonicalize the time value only when serializing its computed value.
This commit is contained in:
parent
2672fe99b7
commit
d0be5a0cdf
Notes:
github-actions[bot]
2025-03-20 17:00:33 +00:00
Author: https://github.com/tcl3
Commit: d0be5a0cdf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4004
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 35 additions and 2 deletions
|
@ -28,7 +28,7 @@ Time Time::percentage_of(Percentage const& percentage) const
|
|||
|
||||
String Time::to_string() const
|
||||
{
|
||||
return MUST(String::formatted("{}s", to_seconds()));
|
||||
return MUST(String::formatted("{}{}", raw_value(), unit_name()));
|
||||
}
|
||||
|
||||
double Time::to_seconds() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue