Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
feat(core): display the end date of the scheduled incidents
Browse files Browse the repository at this point in the history
  • Loading branch information
giovagnoli committed Mar 14, 2019
1 parent 22c85d2 commit 858c3ea
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
15 changes: 15 additions & 0 deletions packages/@statusfy/core/client/components/Incident.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,15 @@
<div v-else>
<nice-date
:date="incident.scheduled"
:include-u-t-c="false"
format="long"
/>
&nbsp;-&nbsp;
<nice-date
:date="getScheduledEndDate()"
:include-u-t-c="false"
format="long"
/> (UTC)
</div>
</div>

Expand Down Expand Up @@ -184,6 +191,14 @@ export default {
el.appendChild(iconElement);
});
}
},
methods: {
getScheduledEndDate() {
return this.$statusfy.dates
.parse(this.incident.scheduled)
.add(this.incident.duration, "m")
.toISOString();
}
}
};
</script>
13 changes: 8 additions & 5 deletions packages/@statusfy/core/client/components/NiceDate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default {
type: String,
required: true
},
includeUTC: {
type: Boolean,
default: true
},
format: {
default: "short",
validator: value => ["short", "long", "month"].indexOf(value) !== -1
Expand All @@ -20,12 +24,11 @@ export default {
label() {
const $t = this.$t.bind(this);
const parsedDate = this.$statusfy.dates.parse(this.date);
const format = this.includeUTC
? $t(`dates.formats.${this.format}`)
: $t(`dates.formats.${this.format}`).replace(" UTC", "");
return this.$statusfy.dates.format(
parsedDate,
$t(`dates.formats.${this.format}`),
this.$i18n.locale
);
return this.$statusfy.dates.format(parsedDate, format, this.$i18n.locale);
}
}
};
Expand Down

0 comments on commit 858c3ea

Please sign in to comment.