12-23-上传master
This commit is contained in:
45
src/utils/DateUtils.ts
Normal file
45
src/utils/DateUtils.ts
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* @Author: liqiang
|
||||
* @Date: 2020-12-02 14:25:23
|
||||
* @LastEditTime: 2020-12-07 14:59:14
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: 日期工具类
|
||||
* @FilePath: \ebtp-cloud-frontend\src\utils\DateUtils.ts
|
||||
*/
|
||||
|
||||
import moment from "moment";
|
||||
import { isEmpty } from "./CommonUtils";
|
||||
/**
|
||||
* 日期时间格式
|
||||
*/
|
||||
export const dateTimeFormatter = 'yyyy-MM-DD HH:mm:ss';
|
||||
|
||||
/**
|
||||
* 用于保存 日期格式化
|
||||
* @param date
|
||||
*/
|
||||
export function saveDateTimeFormatter(date: any) {
|
||||
if (isEmpty(date)) {
|
||||
return date;
|
||||
}
|
||||
return date.format(dateTimeFormatter);
|
||||
}
|
||||
/**
|
||||
* 用于回显 日期格式化
|
||||
* @param date
|
||||
*/
|
||||
export function echoDateTimeFormatter(date: any) {
|
||||
if (isEmpty(date)) {
|
||||
return date;
|
||||
}
|
||||
return moment(date, dateTimeFormatter);
|
||||
}
|
||||
/**
|
||||
* 判断当前时间是否超过指定时间
|
||||
*/
|
||||
export function nowExceedSpecifiedTime(specifiedTime: string) {
|
||||
let now = new Date(),
|
||||
specified = new Date(specifiedTime);
|
||||
return now.getTime() > specified.getTime();
|
||||
}
|
||||
|
Reference in New Issue
Block a user