Bug 1846847 [wpt PR 41301] - [FedCM] Don't omit schemes when formatting URLs, a=testonly
[gecko.git] / js / src / jsdate.h
blobb74dd1208414cc56e258b8c907c9e59c3b3ebc7e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /*
8 * JS Date class interface.
9 */
11 #ifndef jsdate_h
12 #define jsdate_h
14 #include "jstypes.h"
16 #include "js/Date.h"
17 #include "js/RootingAPI.h"
18 #include "js/TypeDecls.h"
20 namespace js {
23 * These functions provide a C interface to the date/time object
27 * Construct a new Date Object from a time value given in milliseconds UTC
28 * since the epoch.
30 extern JSObject* NewDateObjectMsec(JSContext* cx, JS::ClippedTime t,
31 JS::HandleObject proto = nullptr);
34 * Construct a new Date Object from an exploded local time value.
36 * Assert that mon < 12 to help catch off-by-one user errors, which are common
37 * due to the 0-based month numbering copied into JS from Java (java.util.Date
38 * in 1995).
40 extern JS_PUBLIC_API JSObject* NewDateObject(JSContext* cx, int year, int mon,
41 int mday, int hour, int min,
42 int sec);
45 * Returns the current time in milliseconds since the epoch.
47 JS::ClippedTime DateNow(JSContext* cx);
49 /* Date methods exposed so they can be installed in the self-hosting global. */
50 bool date_now(JSContext* cx, unsigned argc, JS::Value* vp);
52 bool date_valueOf(JSContext* cx, unsigned argc, JS::Value* vp);
54 } /* namespace js */
56 #endif /* jsdate_h */