Skip to content

Commit

Permalink
Fix time discrepancy when editing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Augustin-FL committed Dec 27, 2024
1 parent dd88dfd commit dea9ce1
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions incidents/static/custom_js/details_actions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
function Z(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}

$(function () {
$('#details-actions-add-link').click(function (event) {
$('.details-actions-supmenu').hide();
Expand Down Expand Up @@ -86,7 +79,7 @@ $(function () {

$("#id_action").val('');
var date = new Date();
date = date.getFullYear() + "-" + Z((date.getMonth()+1)) +"-" + Z(date.getDate()) + " " + Z(date.getHours()) + ":" + Z(date.getMinutes())
date = new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000).toISOString().slice(0, 16)
$("#id_date").val(date);
});

Expand All @@ -100,8 +93,7 @@ $(function () {
var text = comment.fields.comment;
var action = comment.fields.action;
var date = new Date(comment.fields.date);
// date format 1899-12-06 07:15
date = date.getUTCFullYear() + "-" + (Z(date.getUTCMonth()+1)) +"-" + Z(date.getUTCDate()) + " " + Z(date.getUTCHours()) + ":" + Z(date.getUTCMinutes())
date = new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000).toISOString().slice(0, 16)

$("#addComment").modal('toggle');

Expand Down

0 comments on commit dea9ce1

Please sign in to comment.