Skip to content

Commit de461d2

Browse files
hoangpnvincent-olivert-riera
authored andcommitted
Always use UTC Timezone for Silence
When creating a Silence, users can specify the startsAt and endsAt times using a date-time picker on the UI. This picker displays the current date and time based on the user's browser. However, these values are sent to the Promgen server without a timezone. As a result, Promgen automatically adds the server's current timezone as the Silence's timezone. This can lead to time discrepancies if the timezones between the user and the Promgen server are different. To fix this issue, we have updated the UI to always use UTC date and time when sending a Silence creation request to the Promgen server. This ensures that UTC is consistently used across the client, the server, and Alertmanager.
1 parent c3d1c02 commit de461d2

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

promgen/static/js/promgen.vue.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,12 @@ app.component('silence-create-modal', {
256256

257257
const body = JSON.stringify({
258258
matchers: matchers,
259-
startsAt: this.form.startsAt,
260-
endsAt: this.form.endsAt,
259+
startsAt: this.form.startsAt
260+
? new Date(this.form.startsAt).toISOString()
261+
: undefined,
262+
endsAt: this.form.endsAt
263+
? new Date(this.form.endsAt).toISOString()
264+
: undefined,
261265
duration: this.form.duration,
262266
createdBy: this.form.createdBy,
263267
comment: this.form.comment

promgen/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
</script>
6767
<script src="{% static 'js/promgen.js' %}?v=5"></script>
6868
<script src="{% static 'js/mixins.vue.js' %}"></script>
69-
<script src="{% static 'js/promgen.vue.js' %}?v=5"></script>
69+
<script src="{% static 'js/promgen.vue.js' %}?v=6"></script>
7070
{% block javascript %}{% endblock %}
7171

7272
<datalist style="display:none" id="common.labels">

0 commit comments

Comments
 (0)