修改大小月判断条件错误的bug
This commit is contained in:
parent
66278da73f
commit
905f7f3134
|
@ -3,7 +3,6 @@ import {
|
|||
CSSResultArray,
|
||||
html,
|
||||
HTMLTemplateResult,
|
||||
TemplateResult,
|
||||
nothing,
|
||||
} from 'lit'
|
||||
import {customElement, property, query} from 'lit/decorators.js'
|
||||
|
@ -70,7 +69,7 @@ export interface options {
|
|||
startDate?: ''
|
||||
}
|
||||
|
||||
// 时间选择器选项——此处后续优化部分
|
||||
// 时间选择器选项——此处为后续优化部分
|
||||
export interface opt {
|
||||
container: string
|
||||
scrollType: string
|
||||
|
@ -90,7 +89,7 @@ export interface opt {
|
|||
|
||||
export type itemdate = {
|
||||
value: number
|
||||
display: number
|
||||
display: string
|
||||
}
|
||||
|
||||
// 定义滚轮内容类型
|
||||
|
@ -915,8 +914,8 @@ export class PickerBase extends LitElement {
|
|||
}
|
||||
}
|
||||
|
||||
public addZero(num: number): number {
|
||||
return num < 10 ? num : num
|
||||
public addZero(num: number){
|
||||
return num < 10 ? '0' + num : String(num)
|
||||
}
|
||||
|
||||
public opt: opt = {
|
||||
|
@ -987,23 +986,23 @@ export class PickerBase extends LitElement {
|
|||
public initDateInfo() {
|
||||
// 年
|
||||
for (let i = this.beginYear; i <= this.endYear; i++) {
|
||||
this.yearData.push({value: this.addZero(i), display: this.addZero(i)})
|
||||
this.yearData.push({value: i, display: this.addZero(i)})
|
||||
}
|
||||
// 月
|
||||
for (let i = 1; i <= 12; i++) {
|
||||
this.monthData.push({value: this.addZero(i), display: this.addZero(i)})
|
||||
this.monthData.push({value: i, display: this.addZero(i)})
|
||||
}
|
||||
// 日
|
||||
for (let i = 1; i <= 31; i++) {
|
||||
this.dayData.push({value: this.addZero(i), display: this.addZero(i)})
|
||||
this.dayData.push({value: i, display: this.addZero(i)})
|
||||
}
|
||||
// 时
|
||||
for (let i = 0; i <= 23; i++) {
|
||||
this.hourData.push({value: this.addZero(i), display: this.addZero(i)})
|
||||
this.hourData.push({value: i, display: this.addZero(i)})
|
||||
}
|
||||
// 分
|
||||
for (let i = 0; i <= 59; i++) {
|
||||
this.minuteData.push({value: this.addZero(i), display: this.addZero(i)})
|
||||
this.minuteData.push({value: i, display: this.addZero(i)})
|
||||
}
|
||||
// 判断显示日期/时间
|
||||
if (!this.opt.date) {
|
||||
|
@ -1044,9 +1043,9 @@ export class PickerBase extends LitElement {
|
|||
}
|
||||
|
||||
// 判断大小月
|
||||
public bigSmallMonth(dayObj:any, year: number, month: String) {
|
||||
public bigSmallMonth(dayObj:any, year: number, month: number) {
|
||||
let smallMonth =
|
||||
month == '04' || month == '06' || month == '09' || month == '11'
|
||||
month == 4 || month == 6 || month == 9 || month == 11
|
||||
dayObj.appendItem([
|
||||
{value: '29', display: '29'},
|
||||
{value: '30', display: '30'},
|
||||
|
@ -1054,7 +1053,7 @@ export class PickerBase extends LitElement {
|
|||
])
|
||||
if (smallMonth) {
|
||||
dayObj.removeItem(['31'])
|
||||
} else if (month == '02') {
|
||||
} else if (month == 2) {
|
||||
if (this.isLeepTear(year)) {
|
||||
dayObj.removeItem(['30', '31'])
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue