Vanilla JS 日期选择器显示小时和分钟

问题描述 投票:0回答:1

我有一个显示日期选择器的页面,使用 Vanilla JS Datepicker,

如何显示小时和分钟?

const elem = document.querySelector('input[name="foo"]');
const datepicker = new Datepicker(elem, {
  // ...options
}); 

https://raw.githack.com/mymth/vanillajs-datepicker/v1.3.4/demo/index.html

javascript datepicker vanillajs-datepicker
1个回答
-1
投票

我想这就是你要找的

const elem = document.querySelector('input[name="foo"]');
const datepicker = new Datepicker(elem, {
  time: true, // Enable time picker
  hours: true, // Display hours
  minutes: true, // Display minutes
  // Additional options can be added here
});
© www.soinside.com 2019 - 2024. All rights reserved.