解析Bug #352
Leap years are not supported in date plugin for order list
Description
Task Details
- 订单列表中的日期插件默认值不支持闰年2月29日的显示
- Lake
- Report and Solution
Others
Updated by Zhongbao Ye almost 2 years ago
- % Done changed from 0 to 100
Output(2024/02/29) 居家
- Reason: Hard coding is used when calculating the last day of each month. The last day of February is always the 28th.
- Solution: 2024/02/29 15:00
Modify the algorithm in date to support leap year display
Old: last_day = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][(new Date).getMonth()]
New: last_day = (0 (new Date).getFullYear() % 4 && 0 != (new Date).getFullYear() % 100 || 0 (new Date).getFullYear() % 400) && 1 == (new Date).getMonth() ? "29" : [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][(new Date).getMonth()]protected/views/layouts/desktop.php
ui/desktop/js/order.js