Commit d98d686b authored by tangfh's avatar tangfh

+

parent 5cea3951
## 1.0.5(2024-11-08)
1.0.5
## 1.0.4(2024-11-07)
1.0.4
## 1.0.3(2024-10-29) ## 1.0.3(2024-10-29)
1.0.3 1.0.3
## 1.0.2(2024-10-29) ## 1.0.2(2024-10-29)
......
...@@ -262,7 +262,6 @@ ...@@ -262,7 +262,6 @@
this.initCurr(date) this.initCurr(date)
} }
this.pickerVal = val this.pickerVal = val
console.log('in date: ',date);
this.$emit("change", date) this.$emit("change", date)
}, },
// 点击确定 // 点击确定
...@@ -355,7 +354,6 @@ ...@@ -355,7 +354,6 @@
}, },
// 初始化选中项 // 初始化选中项
initCurr(val, month, day) { initCurr(val, month, day) {
// console.log(val)
this.hasChange = true this.hasChange = true
const { const {
start, start,
...@@ -389,7 +387,6 @@ ...@@ -389,7 +387,6 @@
let endSIFlag = true // 是否在最后统一设置index let endSIFlag = true // 是否在最后统一设置index
if (curr.getTime() >= end.getTime()) { // 值大于等于结束时间 if (curr.getTime() >= end.getTime()) { // 值大于等于结束时间
// console.log(11)
this.months = this.endObj.months this.months = this.endObj.months
this.days = this.endObj.days this.days = this.endObj.days
this.hours = this.endObj.hours this.hours = this.endObj.hours
...@@ -401,7 +398,6 @@ ...@@ -401,7 +398,6 @@
cminui = this.minutes.length - 1 cminui = this.minutes.length - 1
endSIFlag = false endSIFlag = false
} else if (curr.getTime() <= start.getTime()) { // 值小于等于开始时间 } else if (curr.getTime() <= start.getTime()) { // 值小于等于开始时间
// console.log(22)
this.months = this.startObj.months this.months = this.startObj.months
this.days = this.startObj.days this.days = this.startObj.days
this.hours = this.startObj.hours this.hours = this.startObj.hours
...@@ -410,59 +406,49 @@ ...@@ -410,59 +406,49 @@
endSIFlag = false endSIFlag = false
} else if (cy === ey && cm === em && cd === ed && ch === eh) { } else if (cy === ey && cm === em && cd === ed && ch === eh) {
// 值与结束时间年/月/日/时相同 // 值与结束时间年/月/日/时相同
// console.log(222)
this.months = this.endObj.months this.months = this.endObj.months
this.days = this.endObj.days this.days = this.endObj.days
this.hours = this.endObj.hours this.hours = this.endObj.hours
this.minutes = this.endObj.minutes this.minutes = this.endObj.minutes
} else if (cy === ey && cm === em && cd === ed) { } else if (cy === ey && cm === em && cd === ed) {
// 值与结束时间年/月/日相同 // 值与结束时间年/月/日相同
// console.log(111)
this.months = this.endObj.months this.months = this.endObj.months
this.days = this.endObj.days this.days = this.endObj.days
this.hours = this.endObj.hours this.hours = this.endObj.hours
// console.log(this.hours)
this.minutes = this.setArray(0, 59) this.minutes = this.setArray(0, 59)
} else if (cy === ey && cm === em) { // 值与结束时间年、月相同 } else if (cy === ey && cm === em) { // 值与结束时间年、月相同
// console.log(33)
this.months = this.endObj.months this.months = this.endObj.months
this.days = this.endObj.days this.days = this.endObj.days
this.hours = this.setArray(0, 23) this.hours = this.setArray(0, 23)
this.minutes = this.setArray(0, 59) this.minutes = this.setArray(0, 59)
} else if (cy === ey) { // 值与结束时间年份相同 } else if (cy === ey) { // 值与结束时间年份相同
// console.log(44)
this.months = this.endObj.months this.months = this.endObj.months
this.days = this.setDays(cy, cm) this.days = this.setDays(cy, cm)
this.hours = this.setArray(0, 23) this.hours = this.setArray(0, 23)
this.minutes = this.setArray(0, 59) this.minutes = this.setArray(0, 59)
} else if (cy === sy && cm === sm && cd === sd && ch === sh) { } else if (cy === sy && cm === sm && cd === sd && ch === sh) {
// 值与开始时间年/月/日/时相同 // 值与开始时间年/月/日/时相同
// console.log(99)
this.months = this.startObj.months this.months = this.startObj.months
this.days = this.startObj.days this.days = this.startObj.days
this.hours = this.startObj.hours this.hours = this.startObj.hours
this.minutes = this.startObj.minutes this.minutes = this.startObj.minutes
} else if (cy === sy && cm === sm && cd === sd) { } else if (cy === sy && cm === sm && cd === sd) {
// 值与开始时间年/月/日相同 // 值与开始时间年/月/日相同
// console.log(88)
this.months = this.startObj.months this.months = this.startObj.months
this.days = this.startObj.days this.days = this.startObj.days
this.hours = this.startObj.hours this.hours = this.startObj.hours
this.minutes = this.setArray(0, 59) this.minutes = this.setArray(0, 59)
} else if (cy === sy && cm === sm) { // 值与开始时间年、月相同 } else if (cy === sy && cm === sm) { // 值与开始时间年、月相同
// console.log(55)
this.months = this.startObj.months this.months = this.startObj.months
this.days = this.startObj.days this.days = this.startObj.days
this.hours = this.setArray(0, 23) this.hours = this.setArray(0, 23)
this.minutes = this.setArray(0, 59) this.minutes = this.setArray(0, 59)
} else if (cy === sy) { // 值与开始时间年份相同 } else if (cy === sy) { // 值与开始时间年份相同
// console.log(66)
this.months = this.startObj.months this.months = this.startObj.months
this.days = this.setDays(cy, cm) this.days = this.setDays(cy, cm)
this.hours = this.setArray(0, 23) this.hours = this.setArray(0, 23)
this.minutes = this.setArray(0, 59) this.minutes = this.setArray(0, 59)
} else { // 值与开始时间、结束时间不同年月 } else { // 值与开始时间、结束时间不同年月
// console.log(77)
this.months = this.setArray(1, 12) this.months = this.setArray(1, 12)
this.days = this.setDays(cy, cm) this.days = this.setDays(cy, cm)
this.hours = this.setArray(0, 23) this.hours = this.setArray(0, 23)
...@@ -529,9 +515,12 @@ ...@@ -529,9 +515,12 @@
if (typeof val === 'string' && reg.test(val)) { if (typeof val === 'string' && reg.test(val)) {
val = val.replace(/-/g, '/') val = val.replace(/-/g, '/')
} }
console.log('val: ',val);
if (val && ((val+"").split('/').length - 1) == 1) {
val = val + "/" + '01'
}
const curr = new Date(val) const curr = new Date(val)
let result = {
return {
val: curr, val: curr,
y: curr.getFullYear(), y: curr.getFullYear(),
m: month ? month : curr.getMonth() + 1, m: month ? month : curr.getMonth() + 1,
...@@ -539,6 +528,7 @@ ...@@ -539,6 +528,7 @@
h: curr.getHours(), h: curr.getHours(),
minu: curr.getMinutes() minu: curr.getMinutes()
} }
return result
}, },
// 获取一个范围内的整数,返回数组 // 获取一个范围内的整数,返回数组
setArray(start, end) { setArray(start, end) {
......
{ {
"id": "f-date-time-picker", "id": "f-date-time-picker",
"displayName": "f-date-time-picker", "displayName": "f-date-time-picker",
"version": "1.0.3", "version": "1.0.5",
"description": "年月日时分选择组件", "description": "年月日时分选择组件",
"keywords": [ "keywords": [
"f-date-time-picker" "f-date-time-picker"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment