From d2973f1d0644357937542b8358d1d78c29b5c4ea Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 15 Apr 2023 18:21:37 +0000 Subject: [PATCH] case 4504 --- src/views/biz-subscription.vue | 72 ++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/src/views/biz-subscription.vue b/src/views/biz-subscription.vue index 9ed56ca..b4435c1 100644 --- a/src/views/biz-subscription.vue +++ b/src/views/biz-subscription.vue @@ -236,23 +236,25 @@ - + $sockiPlus - One month + One month + 7d $sockiPlus - One year + One year + 7d @@ -633,30 +635,36 @@ export default { } }, subExpireAddOneWeek: function() { - // // eslint-disable-next-line - // debugger; - const now = window.$gz.locale.nowUTC8601String(this.timeZoneName); - this.obj.items[ - this.editItemIndex - ].expireDate = window.$gz.locale.addDurationToUTC8601String(now, { - days: 7 - }); + this.obj.items[this.editItemIndex].expireDate = addToDate( + this.obj.items[this.editItemIndex].expireDate, + { + days: 7 + } + ); }, subExpireAddOneMonth: function() { - const now = window.$gz.locale.nowUTC8601String(this.timeZoneName); - this.obj.items[ - this.editItemIndex - ].expireDate = window.$gz.locale.addDurationToUTC8601String(now, { - months: 1 - }); + this.obj.items[this.editItemIndex].expireDate = addToDate( + this.obj.items[this.editItemIndex].expireDate, + { + months: 1, + days: 7 + } + ); }, subExpireAddOneYear: function() { - const now = window.$gz.locale.nowUTC8601String(this.timeZoneName); - this.obj.items[ - this.editItemIndex - ].expireDate = window.$gz.locale.addDurationToUTC8601String(now, { - years: 1 - }); + this.obj.items[this.editItemIndex].expireDate = addToDate( + this.obj.items[this.editItemIndex].expireDate, + { + years: 1, + days: 7 + } + ); + // const now = window.$gz.locale.nowUTC8601String(this.timeZoneName); + // this.obj.items[ + // this.editItemIndex + // ].expireDate = window.$gz.locale.addDurationToUTC8601String(now, { + // years: 1 + // }); }, canSave: function() { return this.formState.valid && this.formState.dirty; @@ -999,4 +1007,20 @@ async function populateSelectionLists(vm) { await window.$gz.enums.fetchEnumList("productgroup"); vm.selectLists.pGroups = window.$gz.enums.getSelectionList("productgroup"); } + +////////////////////// +// +// +function addToDate(dateValue, span) { + var newDate = dateValue; + if (newDate == null) { + newDate = window.$gz.locale.addDurationToUTC8601String( + window.$gz.locale.nowUTC8601String(), + span + ); + } else { + newDate = window.$gz.locale.addDurationToUTC8601String(newDate, span); + } + return newDate; +}