UI: add finish time (#20706)

This commit is contained in:
Michael Geers 2025-04-19 08:36:25 +02:00 • committed by GitHub
parent 07a238d7d9
commit 2319e0d7ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 0 deletions

View file

@ -64,6 +64,11 @@ export default {
value: this.fmtDuration(this.chargeRemainingDurationInterpolated),
available: this.chargeRemainingDurationInterpolated > 0,
},
{
key: "finished",
value: this.fmtHourMinute(this.finishTime),
available: this.chargeRemainingDurationInterpolated > 0,
},
{
key: "duration",
value: this.fmtDuration(this.chargeDurationInterpolated),
@ -119,6 +124,14 @@ export default {
showSm() {
return this.valueSm !== undefined;
},
finishTime() {
const remainingSeconds = this.chargeRemainingDurationInterpolated;
if (remainingSeconds > 0) {
const now = new Date();
return new Date(now.getTime() + remainingSeconds * 1000);
}
return undefined;
},
solarFormatted() {
return this.fmtPercentage(this.sessionSolarPercentage, 1);
},

View file

@ -201,6 +201,12 @@ export default defineComponent({
return `${weekday} ${hour}`.trim();
},
fmtHourMinute(date: Date) {
return new Intl.DateTimeFormat(this.$i18n?.locale, {
hour: "numeric",
minute: "numeric",
}).format(date);
},
fmtFullDateTime(date: Date, short: boolean) {
return new Intl.DateTimeFormat(this.$i18n?.locale, {
weekday: short ? undefined : "short",

View file

@ -614,6 +614,7 @@ charged = "Geladen"
co2 = "⌀ CO₂"
duration = "Ladedauer"
fallbackName = "Ladepunkt"
finished = "Ladeende"
power = "Leistung"
price = "Kosten"
remaining = "Restzeit"

View file

@ -613,6 +613,7 @@ charged = "Charged"
co2 = "⌀ CO₂"
duration = "Duration"
fallbackName = "Charging point"
finished = "Finish time"
power = "Power"
price = "Cost"
remaining = "Remaining"