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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user