mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
LibJS: Add toLocaleString(), toLocaleDateString(), toLocaleTimeString() to Date
These just return a "readable" implementation of the date for now.
This commit is contained in:
parent
8ebef785eb
commit
a3908732ad
3 changed files with 41 additions and 0 deletions
|
@ -52,6 +52,11 @@ public:
|
|||
return String::format("%s %s", date_string().characters(), time_string().characters());
|
||||
}
|
||||
|
||||
// FIXME: One day, implement real locale support. Until then, everyone gets what the Clock MenuApplet displays.
|
||||
String locale_date_string() const { return m_datetime.to_string("%Y-%m-%d"); }
|
||||
String locale_string() const { return m_datetime.to_string(); }
|
||||
String locale_time_string() const { return m_datetime.to_string("%H:%M:%S"); }
|
||||
|
||||
virtual Value value_of() const override
|
||||
{
|
||||
return Value(static_cast<double>(m_datetime.timestamp() * 1000 + m_milliseconds));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue