Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline format fixes #3932

Merged
merged 4 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/dispatch/static/dispatch/src/components/DateTimePickerMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
</template>
<script>
import { parseISO } from "date-fns"
import { format } from "date-fns-tz"
import { formatInTimeZone, format } from "date-fns-tz"
import moment from "moment-timezone"

export default {
name: "DateTimePickerMenu",
Expand Down Expand Up @@ -84,12 +85,12 @@ export default {
initDateTime = parseISO(this.modelValue)
}

this.selectedDatetime = format(initDateTime, "yyyy-MM-dd'T'HH:mm", { timeZone: "UTC" })
this.selectedDatetime = formatInTimeZone(initDateTime, this.timezone, "yyyy-MM-dd'T'HH:mm")
},
okHandler() {
this.resetPicker()
let isoString = parseISO(this.selectedDatetime).toISOString()
this.$emit("update:modelValue", isoString)
let newValue = moment.tz(this.selectedDatetime, this.timezone).utc().format()
this.$emit("update:modelValue", newValue)
},
clearHandler() {
this.resetPicker()
Expand All @@ -106,6 +107,13 @@ export default {
modelValue() {
this.init()
},
timezone() {
this.selectedDatetime = formatInTimeZone(
parseISO(this.modelValue),
this.timezone,
"yyyy-MM-dd'T'HH:mm"
)
},
},
}
</script>
17 changes: 13 additions & 4 deletions src/dispatch/static/dispatch/src/incident/EditEventDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,35 @@
<v-card-text>
<v-container class="mt-3">
<v-row>
<v-col cols="12">
<v-col cols="5">
<date-time-picker-menu
label="Reported At"
v-model="started_at"
class="time-picker"
:timezone="timezone"
/>
<span
class="ml-10 time-utc text-caption"
style="position: absolute; margin-top: -20px"
>
Time in UTC is {{ formatToUTC(started_at) }}
</span>
</v-col>
<v-col cols="5">
<v-select
v-model="timezone"
label="Time zone"
:items="timezones"
class="ml-2 time-zone-select"
/>
</v-col>
<v-col cols="1">
<v-btn color="green en-1" class="ml-10 mt-3" width="100" @click="setTimeToNow()">
Now
</v-btn>
</v-col>
<v-col cols="12">
<span class="ml-8 time-utc"> Time in UTC is {{ formatToUTC(started_at) }} </span>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-textarea
v-model="description"
Expand Down
3 changes: 3 additions & 0 deletions src/dispatch/static/dispatch/src/incident/TimelineTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
:class="classType(event)"
dot-color="blue"
>
<template #icon>
<v-icon color="white" />
</template>
<v-row justify="space-between">
<v-col cols="7">
{{ event.description }}
Expand Down
Loading