Add more timestampformatting methods

This commit is contained in:
Matthias 2020-07-11 17:15:13 +02:00
parent b9bfab7722
commit b31df7c644

View File

@ -16,6 +16,14 @@ export function timestampms(ts: number | Date): string {
return moment.utc(ts).format('YYYY-MM-DD HH:mm:ss');
}
export function timestampToDateString(ts: number): string {
return moment(ts).format('YYYY-MM-DD');
}
export function dateStringToTimeRange(ts: string): string {
return ts.replace(/-/g, '');
}
export function timestampHour(ts: number | Date): number {
return moment.utc(ts).hour();
}
@ -24,4 +32,6 @@ export default {
formatPrice,
formatPercent,
timestampms,
timestampToDateString,
dateStringToTimeRange,
};