Home >Web Front-end >Layui Tutorial >How to modify the layui date start and end time selector to 1900 after resetting it

How to modify the layui date start and end time selector to 1900 after resetting it

下次还敢
下次还敢Original
2024-04-04 02:45:20854browse

layui date start and end time selector is modified to 1900 after reset

Question: How to modify layui date start and end time selector to be reset to 1900?

Solution:

  1. Modify the startTime parameter
<code class="javascript">layui.laydate.render({
  elem: '#开始时间',
  type: 'datetime',
  startTime: '2012-01-01 00:00:00' // 修改为起始时间
});</code>
  1. Modify endTime parameter
<code class="javascript">layui.laydate.render({
  elem: '#结束时间',
  type: 'datetime',
  endTime: '2023-12-31 23:59:59' // 修改为结束时间
});</code>
  1. Use range parameter
<code class="javascript">layui.laydate.render({
  elem: '#日期范围',
  type: 'datetime',
  range: true,
  value: '2022-03-01 00:00:00 ~ 2022-03-31 23:59:59' // 设置初始范围值
});</code>

Note:

  • The start time and end time must conform to the format of yyyy-MM-dd HH:mm:ss.
  • When using the range parameter, the value parameter must be a combination of two time ranges, separated by ~.

The above is the detailed content of How to modify the layui date start and end time selector to 1900 after resetting it. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn