mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
Add more timestampformatting methods
This commit is contained in:
parent
b9bfab7722
commit
b31df7c644
|
@ -16,6 +16,14 @@ export function timestampms(ts: number | Date): string {
|
||||||
return moment.utc(ts).format('YYYY-MM-DD HH:mm:ss');
|
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 {
|
export function timestampHour(ts: number | Date): number {
|
||||||
return moment.utc(ts).hour();
|
return moment.utc(ts).hour();
|
||||||
}
|
}
|
||||||
|
@ -24,4 +32,6 @@ export default {
|
||||||
formatPrice,
|
formatPrice,
|
||||||
formatPercent,
|
formatPercent,
|
||||||
timestampms,
|
timestampms,
|
||||||
|
timestampToDateString,
|
||||||
|
dateStringToTimeRange,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user