Bug fixes on Subscription termination date format [Fixes Issues #9186] (#9583)

* Fixed date.

* Got rid of the filter and returned moment.

* fix the return value

* Stupid typo.
This commit is contained in:
tim1234ltp 2017-11-28 16:19:29 +08:00 committed by Matteo Pagliazzi
parent f1e200c0f5
commit 4ab89fd3e0

View file

@ -33,7 +33,7 @@
span.noninteractive-button.btn-danger {{ $t('canceledSubscription') }}
i.glyphicon.glyphicon-time
| {{ $t('subCanceled') }}  
strong {{user.purchased.plan.dateTerminated | date}}
strong {{dateTerminated}}
tr(v-if='!hasCanceledSubscription'): td
h4 {{ $t('subscribed') }}
p(v-if='hasPlan && !hasGroupPlan') {{ $t('purchasedPlanId', purchasedPlanIdInfo) }}
@ -143,13 +143,6 @@ export default {
},
};
},
filters: {
date (value) {
if (!value) return '';
return moment(value);
// return moment(value).format(this.user.preferences.dateFormat); // @TODO make that work (`TypeError: this is undefined`)
},
},
computed: {
...mapState({user: 'user.data', credentials: 'credentials'}),
subscriptionBlocksOrdered () {
@ -237,6 +230,10 @@ export default {
amount: this.numberOfMysticHourglasses,
};
},
dateTerminated () {
if (!this.user.preferences || !this.user.preferences.dateFormat) return this.user.purchased.plan.dateTerminated;
return moment(this.user.purchased.plan.dateTerminated).format(this.user.preferences.dateFormat.toUpperCase());
},
canCancelSubscription () {
return (
this.user.purchased.plan.paymentMethod !== this.paymentMethods.GOOGLE &&