mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
LibJS: Implement Date.prototype.to{Date,Time}String()
This commit is contained in:
parent
dc9b1226ac
commit
3fcea71538
3 changed files with 31 additions and 2 deletions
|
@ -36,6 +36,11 @@ public:
|
|||
|
||||
Core::DateTime& datetime() { return m_datetime; }
|
||||
u16 milliseconds() { return m_milliseconds; }
|
||||
|
||||
String date_string() { return m_datetime.to_string("%a %b %d %Y"); }
|
||||
// FIXME: Deal with timezones once SerenityOS has a working tzset(3)
|
||||
String time_string() { return m_datetime.to_string("%T GMT+0000 (UTC)"); }
|
||||
|
||||
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