Skip to content

Commit

Permalink
[Fix] Fix history timestamp parsing.
Browse files Browse the repository at this point in the history
The timestamp parsing was wrong, causing all history records to appear as being created at epoch.
  • Loading branch information
ledsoft committed Nov 13, 2023
1 parent 3a8a6f1 commit 7df0d22
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions js/utils/Utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
import Bowser from 'bowser';
import * as Constants from "../constants/DefaultConstants";
import {ROLE} from "../constants/DefaultConstants";
import * as Vocabulary from "../constants/Vocabulary";
import * as supportedDevices from "../constants/SupportedDevices";
import {ROLE} from "../constants/DefaultConstants";

/**
* Common propositions that should not be capitalized
Expand Down Expand Up @@ -274,13 +274,11 @@ export function deviceIsSupported() {

// format to DD-MM-YYYY HH:mm:ss:SSS
export function formatDateWithMilliseconds(timestamp) {
const date = new Date(timestamp / 1000);
const dateStr =
("00" + date.getDate()).slice(-2) + "-" +
const date = new Date(timestamp);
return ("00" + date.getDate()).slice(-2) + "-" +
("00" + (date.getMonth() + 1)).slice(-2) + "-" +
date.getFullYear() + " " +
("00" + date.getHours()).slice(-2) + ":" +
("00" + date.getMinutes()).slice(-2) + ":" +
("00" + date.getSeconds()).slice(-2) + ("00" + date.getMilliseconds()).slice(-2);
return dateStr;
}

0 comments on commit 7df0d22

Please sign in to comment.