fix: hour display luxon

This commit is contained in:
2025-06-09 14:47:53 +02:00
parent bd7d669e4b
commit 8ad18e8670

View File

@@ -1,5 +1,5 @@
import { Component, Input } from '@angular/core';
import moment from 'moment';
import { DateTime } from "luxon";
@Component({
selector: 'app-hour-display',
@@ -12,10 +12,10 @@ export class HourDisplayComponent {
style () {
if (/(0+[0-9]|1[0-9]|2[0-3]):(0+[0-9]|[1-5][0-9])/g.test(this.value)) {
var diff = moment(this.value, 'HH:mm').diff(moment(), 'minutes');
if (diff > 30) {
var diff = DateTime.fromFormat(this.value, "HH:mm").diffNow("minutes")
if (diff.as("minutes") > 30) {
return { "background-color": "red" }
} else if (diff > 0) {
} else if (diff.as("minutes") > 0) {
return { "background-color": "yellow", "color": "black"}
} else {
return { "background-color": "green"}