Use DatetimeTZ also in botstatus

closes #211
This commit is contained in:
Matthias 2021-07-01 20:41:55 +02:00
parent 205928e517
commit e97bfa8788
2 changed files with 16 additions and 8 deletions

View File

@ -10,9 +10,11 @@
</p>
<p v-if="profit.first_trade_timestamp">
First trade opened:
<strong>{{ formatTimestamp(profit.first_trade_timestamp) }}</strong> <br />
<strong><DateTimeTZ :date="profit.first_trade_timestamp" show-timezone /></strong>
<br />
Last trade opened:
<strong>{{ formatTimestamp(profit.latest_trade_timestamp) }}</strong>
<strong><DateTimeTZ :date="profit.latest_trade_timestamp" show-timezone /></strong>
</p>
<p>
@ -40,10 +42,11 @@ import { namespace } from 'vuex-class';
import { BotState } from '@/types';
import { formatPercent } from '@/shared/formatters';
import DateTimeTZ from '@/components/general/DateTimeTZ.vue';
const ftbot = namespace('ftbot');
@Component({})
@Component({ components: { DateTimeTZ } })
export default class BotStatus extends Vue {
@ftbot.State version;
@ -52,9 +55,5 @@ export default class BotStatus extends Vue {
@ftbot.State botState?: BotState;
formatPercent = formatPercent;
formatTimestamp(timestamp) {
return new Date(timestamp).toUTCString();
}
}
</script>

View File

@ -1,5 +1,5 @@
<template>
<span :title="timezoneTooltip">{{ timestampms(date) }}</span>
<span :title="timezoneTooltip">{{ formattedDate }}</span>
</template>
<script lang="ts">
@ -10,8 +10,17 @@ import { Component, Prop, Vue } from 'vue-property-decorator';
export default class DateTimeTZ extends Vue {
@Prop({ required: true, type: Number }) date!: number;
@Prop({ required: false, type: Boolean, default: false }) showTimezone!: boolean;
timestampms = timestampms;
get formattedDate(): string {
if (this.showTimezone) {
return timestampmsWithTimezone(this.date);
}
return timestampms(this.date);
}
get timezoneTooltip(): string {
const time1 = timestampmsWithTimezone(this.date);
const timeUTC = timestampmsWithTimezone(this.date, 'UTC');