📜  为什么 JavaScript - Date getMonth() 返回 11 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:00.051000             🧑  作者: Mango

代码示例1
npm install --save proposal-temporal

// temporal-test.js
const { Temporal } = require('proposal-temporal');

// or as an ES module
// import { Temporal } from 'proposal-temporal/lib/index.mjs';

// 11 means November now!
const date = new Temporal.PlainDate(2020, 11, 26); // => 2020-11-26

const sameDate = Temporal.PlainDate.from(
                {year: 2020, month: 11, day: 26}); // => 2020-11-26