!39 fix(utils): 补充缺失的getDateByPicker函数
* fix(utils): 补充缺失的getDateByPicker函数 * refactor(user): 移除未使用的UserQuitModal组件
This commit is contained in:
@@ -632,3 +632,23 @@ export const split = (str) => {
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
export function getDateByPicker(value: any, picker: string) {
|
||||
if (!value) return value;
|
||||
if (typeof value === 'string') return value;
|
||||
if (value && typeof value.format === 'function') {
|
||||
switch (picker) {
|
||||
case 'date':
|
||||
return value.format('YYYY-MM-DD');
|
||||
case 'month':
|
||||
return value.format('YYYY-MM');
|
||||
case 'datetime':
|
||||
return value.format('YYYY-MM-DD HH:mm:ss');
|
||||
case 'time':
|
||||
return value.format('HH:mm:ss');
|
||||
default:
|
||||
return value.format(picker);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user