mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 19:06:36 +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.
|
// it's the last entry. Find all logbook entries after start.
|
||||||
const startTime = new Date(startTrace[0].timestamp);
|
const startTime = new Date(startTrace[0].timestamp);
|
||||||
const idx = this.logbookEntries.findIndex(
|
const idx = this.logbookEntries.findIndex(
|
||||||
(entry) => new Date(entry.when) >= startTime
|
(entry) => new Date(entry.when * 1000) >= startTime
|
||||||
);
|
);
|
||||||
if (idx === -1) {
|
if (idx === -1) {
|
||||||
entries = [];
|
entries = [];
|
||||||
@ -210,7 +210,7 @@ export class HaTracePathDetails extends LitElement {
|
|||||||
entries = [];
|
entries = [];
|
||||||
|
|
||||||
for (const entry of this.logbookEntries || []) {
|
for (const entry of this.logbookEntries || []) {
|
||||||
const entryDate = new Date(entry.when);
|
const entryDate = new Date(entry.when * 1000);
|
||||||
if (entryDate >= startTime) {
|
if (entryDate >= startTime) {
|
||||||
if (entryDate < endTime) {
|
if (entryDate < endTime) {
|
||||||
entries.push(entry);
|
entries.push(entry);
|
||||||
|
@ -116,7 +116,7 @@ class LogbookRenderer {
|
|||||||
maybeRenderItem() {
|
maybeRenderItem() {
|
||||||
const logbookEntry = this.curItem;
|
const logbookEntry = this.curItem;
|
||||||
this.curIndex++;
|
this.curIndex++;
|
||||||
const entryDate = new Date(logbookEntry.when);
|
const entryDate = new Date(logbookEntry.when * 1000);
|
||||||
|
|
||||||
if (this.pendingItems.length === 0) {
|
if (this.pendingItems.length === 0) {
|
||||||
this.pendingItems.push([entryDate, logbookEntry]);
|
this.pendingItems.push([entryDate, logbookEntry]);
|
||||||
@ -248,7 +248,7 @@ class ActionRenderer {
|
|||||||
// Render all logbook items that are in front of this item.
|
// Render all logbook items that are in front of this item.
|
||||||
while (
|
while (
|
||||||
this.logbookRenderer.hasNext &&
|
this.logbookRenderer.hasNext &&
|
||||||
new Date(this.logbookRenderer.curItem.when) < timestamp
|
new Date(this.logbookRenderer.curItem.when * 1000) < timestamp
|
||||||
) {
|
) {
|
||||||
this.logbookRenderer.maybeRenderItem();
|
this.logbookRenderer.maybeRenderItem();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user