Temporal.Now.plainDateISO()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Phương thức tĩnh Temporal.Now.plainDateISO() trả về ngày hiện tại như là đối tượng Temporal.PlainDate, theo lịch ISO 8601 và múi giờ được chỉ định.
Cú pháp
js
Temporal.Now.plainDateISO()
Temporal.Now.plainDateISO(timeZone)
Tham số
timeZoneOptional-
Một chuỗi hoặc một thực thể
Temporal.ZonedDateTimebiểu diễn múi giờ để diễn giải thời gian hệ thống. Nếu là thực thểTemporal.ZonedDateTime, múi giờ của nó được sử dụng. Nếu là chuỗi, nó có thể là định danh múi giờ có tên, định danh múi giờ theo độ lệch, hoặc chuỗi ngày-giờ chứa định danh múi giờ hoặc độ lệch (xem múi giờ và độ lệch để biết thêm thông tin).
Giá trị trả về
Ngày hiện tại theo múi giờ được chỉ định, như là đối tượng Temporal.PlainDate sử dụng lịch ISO 8601.
Ngoại lệ
RangeError-
Được ném nếu múi giờ không hợp lệ.
Ví dụ
>Sử dụng Temporal.Now.plainDateISO()
js
// The current date in the system's time zone
const date = Temporal.Now.plainDateISO();
console.log(date); // e.g.: 2021-10-01
// The current date in the "America/New_York" time zone
const dateInNewYork = Temporal.Now.plainDateISO("America/New_York");
console.log(dateInNewYork); // e.g.: 2021-09-30
Đặc tả
| Specification |
|---|
| Temporal> # sec-temporal.now.plaindateiso> |