mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:47:35 +00:00
js: Implement print function for Date objects
This commit is contained in:
parent
839beb52f3
commit
632231cc0c
3 changed files with 23 additions and 12 deletions
|
@ -35,11 +35,16 @@ public:
|
|||
virtual ~Date() override;
|
||||
|
||||
Core::DateTime& datetime() { return m_datetime; }
|
||||
const Core::DateTime& datetime() const { return m_datetime; }
|
||||
u16 milliseconds() { return m_milliseconds; }
|
||||
|
||||
String date_string() { return m_datetime.to_string("%a %b %d %Y"); }
|
||||
String date_string() const { 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)"); }
|
||||
String time_string() const { return m_datetime.to_string("%T GMT+0000 (UTC)"); }
|
||||
String string() const
|
||||
{
|
||||
return String::format("%s %s", date_string().characters(), time_string().characters());
|
||||
}
|
||||
|
||||
virtual Value value_of() const override
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue