chore: always publish time in RFC 3339 (#5886)
This commit is contained in:
parent
f0f1f8c299
commit
72121dbcfe
4 changed files with 9 additions and 6 deletions
|
|
@ -123,7 +123,7 @@
|
|||
<small>
|
||||
{{
|
||||
$t("footer.savings.since", {
|
||||
since: fmtDayMonthYear(startDate),
|
||||
since: startDate,
|
||||
})
|
||||
}}
|
||||
</small>
|
||||
|
|
@ -157,7 +157,7 @@ export default {
|
|||
mixins: [formatter],
|
||||
props: {
|
||||
selfConsumptionPercent: Number,
|
||||
since: { type: Number, default: 0 },
|
||||
since: String,
|
||||
sponsor: String,
|
||||
amount: { type: Number, default: 0 },
|
||||
effectivePrice: { type: Number, default: 0 },
|
||||
|
|
@ -182,7 +182,10 @@ export default {
|
|||
return { value, unit };
|
||||
},
|
||||
startDate() {
|
||||
return new Date(this.since * 1000);
|
||||
if (this.since) {
|
||||
return this.fmtDayMonthYear(new Date(this.since));
|
||||
}
|
||||
return "";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export default {
|
|||
savingsGridCharged: Number,
|
||||
savingsSelfConsumptionCharged: Number,
|
||||
savingsSelfConsumptionPercent: Number,
|
||||
savingsSince: Number,
|
||||
savingsSince: String,
|
||||
savingsTotalCharged: Number,
|
||||
tariffFeedIn: Number,
|
||||
tariffGrid: Number,
|
||||
|
|
|
|||
|
|
@ -586,7 +586,7 @@ func (site *Site) prepare() {
|
|||
site.publish("residualPower", site.ResidualPower)
|
||||
|
||||
site.publish("currency", site.tariffs.Currency.String())
|
||||
site.publish("savingsSince", site.savings.Since().Unix())
|
||||
site.publish("savingsSince", site.savings.Since())
|
||||
|
||||
site.publish("vehicles", vehicleTitles(site.GetVehicles()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ func encode(v interface{}) (string, error) {
|
|||
case time.Time:
|
||||
var b []byte
|
||||
if !val.IsZero() {
|
||||
b, _ = val.MarshalText()
|
||||
b, _ = val.Round(time.Second).Local().MarshalText()
|
||||
}
|
||||
s = fmt.Sprintf(`"%s"`, string(b))
|
||||
case time.Duration:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue