Fix showing sub info (#1785)

This commit is contained in:
Paulus Schoutsen 2018-10-16 23:29:40 +02:00 committed by GitHub
parent a6b4cce7f3
commit af81ede100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,15 +199,23 @@ class HaConfigCloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
}
_formatSubscription(subInfo) {
return subInfo === null
? "Fetching subscription…"
: subInfo.human_description.replace(
"{periodEnd}",
formatDateTime(
new Date(subInfo.subscription.current_period_end * 1000),
this.language
)
);
if (subInfo === null) {
return "Fetching subscription…";
}
let description = subInfo.human_description;
if (subInfo.plan_renewal_date) {
description = description.replace(
"{periodEnd}",
formatDateTime(
new Date(subInfo.plan_renewal_date * 1000),
this.language
)
);
}
return description;
}
_alexaChanged(ev) {