NAME

JavaScript::QuickJS::Date - JavaScript `Date` in Perl

SYNOPSIS

my $date = JavaScript::QuickJS->new()->eval("new Date()");

binmode \*STDOUT, ':encoding(utf-8)';
print $date->toISOString();

DESCRIPTION

This class represents a JavaScript Date instance in Perl.

This class is not instantiated directly.

METHODS

All correspond to their JavaScript equivalents:

  • Getters:

    • getFullYear(), getMonth(), getDate(), getHours(), getMinutes(), getSeconds(), getMilliseconds(), getDay()

    • UTC variants of the above: getUTCFullYear(), getUTCMonth(), getUTCDate(), getUTCHours(), getUTCMinutes(), getUTCSeconds(), getUTCMilliseconds(), getUTCDay()

    • Stringification: toString(), toUTCString(), toGMTString(), toISOString(), toDateString(), toTimeString(), toLocaleString(), toLocaleDateString(), toLocaleTimeString(), toJSON()

    • getTime(), getTimezoneOffset()

  • Setters:

    • setFullYear(), setMonth(), setDate(), setHours(), setMinutes(), setSeconds(), setMilliseconds()

    • UTC variants of the above: setUTCFullYear(), setUTCMonth(), setUTCDate(), setUTCHours(), setUTCMinutes(), setUTCSeconds(), setUTCMilliseconds()

NB: getYear() and setYear() are omitted by design.