Update document: the usage of GLib.DateTime.compare is wrong.
In this API document https://gjs-docs.gnome.org/glib20~2.66.1/glib.datetime#function-compare, about GLib.DateTime.compare
, mark it as a static method.
But as the testing result, it turns out that it's not a static method:
gjs> const {GLib} = imports.gi
gjs> GLib.DateTime.compare(GLib.DateTime.new_now_local(), GLib.DateTime.new_now_local())
typein:4:15 TypeError: GLib.DateTime.compare is not a function
@typein:4:15
@<stdin>:1:42
gjs> print(GLib.DateTime.compare)
undefined
But if I use it as a instance method as this document's suggestion, it works expectedly:
gjs> GLib.DateTime.new_now_local().compare(GLib.DateTime.new_now_local())
-1