mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:57:35 +00:00
LibJS: Convert to_double() to ThrowCompletionOr
This commit is contained in:
parent
51c33b3b35
commit
1639ed7e0a
10 changed files with 23 additions and 40 deletions
|
@ -41,7 +41,7 @@ String DateCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
|||
JS::Value DateCell::js_value(Cell& cell, const CellTypeMetadata&) const
|
||||
{
|
||||
auto js_data = cell.js_data();
|
||||
auto value = js_data.to_double(cell.sheet().global_object());
|
||||
auto value = TRY_OR_DISCARD(js_data.to_double(cell.sheet().global_object()));
|
||||
return JS::Value(value / 1000); // Turn it to seconds
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ String NumericCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
|||
if (metadata.format.is_empty())
|
||||
string = value.to_string_without_side_effects();
|
||||
else
|
||||
string = format_double(metadata.format.characters(), value.to_double(cell.sheet().global_object()));
|
||||
string = format_double(metadata.format.characters(), TRY_OR_DISCARD(value.to_double(cell.sheet().global_object())));
|
||||
|
||||
if (metadata.length >= 0)
|
||||
return string.substring(0, metadata.length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue