feat(DatePicker): support datehour (#6732)

* feat(DatePicker): support datehour

* add unit test & edit readme for datehour

* fix(DatePicker): try to fix unit test
This commit is contained in:
zhangyong
2020-07-11 11:25:11 +08:00
committed by GitHub
parent 7b21a23cae
commit 7987287be0
6 changed files with 344 additions and 2 deletions
+14
View File
@@ -95,6 +95,10 @@ export default createComponent({
result = result.slice(1, 3);
}
if (this.type === 'datehour') {
result = result.slice(0, 4);
}
return result;
},
},
@@ -176,6 +180,10 @@ export default createComponent({
let hour = 0;
let minute = 0;
if (type === 'datehour') {
hour = getValue(3);
}
if (type === 'datetime') {
hour = getValue(3);
minute = getValue(4);
@@ -213,6 +221,12 @@ export default createComponent({
);
}
if (this.type === 'datehour') {
values.push(
formatter('hour', padZero(value.getHours()))
);
}
if (this.type === 'year-month') {
values = values.slice(0, 2);
}