mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 05:47:20 +00:00
Fix python to js timestamp conversions in logbook traces (#12677)
- The websocket version needs the time converted from where python stores the decimal
This commit is contained in:
parent
c41e100c1c
commit
6c48ace41e
@ -194,7 +194,7 @@ export class HaTracePathDetails extends LitElement {
|
||||
// it's the last entry. Find all logbook entries after start.
|
||||
const startTime = new Date(startTrace[0].timestamp);
|
||||
const idx = this.logbookEntries.findIndex(
|
||||
(entry) => new Date(entry.when) >= startTime
|
||||
(entry) => new Date(entry.when * 1000) >= startTime
|
||||
);
|
||||
if (idx === -1) {
|
||||
entries = [];
|
||||
@ -210,7 +210,7 @@ export class HaTracePathDetails extends LitElement {
|
||||
entries = [];
|
||||
|
||||
for (const entry of this.logbookEntries || []) {
|
||||
const entryDate = new Date(entry.when);
|
||||
const entryDate = new Date(entry.when * 1000);
|
||||
if (entryDate >= startTime) {
|
||||
if (entryDate < endTime) {
|
||||
entries.push(entry);
|
||||
|
@ -116,7 +116,7 @@ class LogbookRenderer {
|
||||
maybeRenderItem() {
|
||||
const logbookEntry = this.curItem;
|
||||
this.curIndex++;
|
||||
const entryDate = new Date(logbookEntry.when);
|
||||
const entryDate = new Date(logbookEntry.when * 1000);
|
||||
|
||||
if (this.pendingItems.length === 0) {
|
||||
this.pendingItems.push([entryDate, logbookEntry]);
|
||||
@ -248,7 +248,7 @@ class ActionRenderer {
|
||||
// Render all logbook items that are in front of this item.
|
||||
while (
|
||||
this.logbookRenderer.hasNext &&
|
||||
new Date(this.logbookRenderer.curItem.when) < timestamp
|
||||
new Date(this.logbookRenderer.curItem.when * 1000) < timestamp
|
||||
) {
|
||||
this.logbookRenderer.maybeRenderItem();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user