Files
fe_service_ebtp_frontend/src/utils/DateUtils.ts

46 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-12-23 11:14:35 +08:00
/*
* @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();
}