From ffa89202e69da163a9df905c118a4c263898f482 Mon Sep 17 00:00:00 2001 From: Kalista Payne Date: Mon, 23 Sep 2024 08:37:18 -0500 Subject: [PATCH] Squashed commit of the following: commit 22dc77c0290ac7dd0e4ad91264d07fa5833ac6ba Author: Kalista Payne Date: Tue Sep 17 20:34:00 2024 -0500 fix(event): remove UTC wording commit c72b5dbbee80c7da9839f57102ab45ff3e42b8f7 Author: Kalista Payne Date: Tue Sep 17 20:23:49 2024 -0500 fix(sale): use native JS for showing tz info --- .../src/components/payments/buyGemsModal.vue | 12 ++++++---- website/common/locales/en/limited.json | 2 +- .../common/script/content/constants/events.js | 24 ++++++------------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/website/client/src/components/payments/buyGemsModal.vue b/website/client/src/components/payments/buyGemsModal.vue index f88a013144..20fca7b527 100644 --- a/website/client/src/components/payments/buyGemsModal.vue +++ b/website/client/src/components/payments/buyGemsModal.vue @@ -183,11 +183,10 @@ eventStartMonth: eventInfo.startMonth, eventStartOrdinal: eventInfo.startOrdinal, eventStartTime: eventInfo.startTime, - eventStartUTC: eventInfo.startUTC, eventEndMonth: eventInfo.endMonth, eventEndOrdinal: eventInfo.endOrdinal, eventEndTime: eventInfo.endTime, - eventEndUTC: eventInfo.endUTC, + timeZone: eventInfo.timeZoneAbbrev, }) }} @@ -445,19 +444,24 @@ export default { ); if (!currentEvent) return null; + // https://stackoverflow.com/questions/1954397/detect-timezone-abbreviation-using-javascript#answer-66180857 + const timeZoneAbbrev = new Intl.DateTimeFormat('en-us', { timeZoneName: 'short' }) + .formatToParts(new Date()) + .find(part => part.type === 'timeZoneName') + .value; + return { name: currentEvent.event, class: currentEvent.gemsPromo ? `event-${currentEvent.event}` : '', gemsPromo: currentEvent.gemsPromo, promo: currentEvent.promo, + timeZoneAbbrev, startMonth: moment(currentEvent.start).format('MMMM'), startOrdinal: moment(currentEvent.start).format('Do'), startTime: moment(currentEvent.start).format('hh:mm A'), - startUTC: moment(currentEvent.start).utc().format('hh:mm A'), endMonth: moment(currentEvent.end).format('MMMM'), endOrdinal: moment(currentEvent.end).format('Do'), endTime: moment(currentEvent.end).format('hh:mm A'), - endUTC: moment(currentEvent.end).utc().format('hh:mm A'), }; }, isGemsPromoActive () { diff --git a/website/common/locales/en/limited.json b/website/common/locales/en/limited.json index 70be383421..614d34a94a 100644 --- a/website/common/locales/en/limited.json +++ b/website/common/locales/en/limited.json @@ -238,7 +238,7 @@ "g1g1Limitations": "This is a limited time event that starts on <%= promoStartMonth %> <%= promoStartOrdinal %> at <%= promoStartTime %> and will end <%= promoEndMonth %> <%= promoEndOrdinal %> at <%= promoEndTime %>. This promotion only applies when you gift to another Habitican. If you or your gift recipient already have a subscription, the gifted subscription will add months of credit that will only be used after the current subscription is canceled or expires.", "noLongerAvailable": "This item is no longer available.", "gemSaleHow": "Between <%= eventStartMonth %> <%= eventStartOrdinal %> and <%= eventEndOrdinal %>, simply purchase any Gem bundle like usual and your account will be credited with the promotional amount of Gems. More Gems to spend, share, or save for any future releases!", - "gemSaleLimitationsText": "This promotion only applies during the limited time event. This event starts on <%= eventStartMonth %> <%= eventStartOrdinal %> at <%= eventStartTime %> local time (<%= eventStartUTC %> UTC) and will end <%= eventEndMonth %> <%= eventEndOrdinal %> at <%= eventEndTime %> local time (<%= eventEndUTC %> UTC). The promo offer is only available when buying Gems for yourself.", + "gemSaleLimitationsText": "This promotion only applies during the limited time event. This event starts on <%= eventStartMonth %> <%= eventStartOrdinal %> at <%= eventStartTime %> <%= timeZone %> and will end on <%= eventEndMonth %> <%= eventEndOrdinal %> at <%= eventEndTime %> <%= timeZone %>. The promo offer is only available when buying Gems for yourself.", "anniversaryLimitations": "This is a limited time event that starts on January 30th at 8:00 AM ET (13:00 UTC) and will end February 8th at 11:59 PM ET (04:59 UTC). The Limited Edition Jubilant Gryphatrice and ten Magic Hatching Potions will be available to buy during this time. The other Gifts listed in the Four for Free section will be automatically delivered to all accounts that were active in the 30 days prior to day the gift is sent. Accounts created after the gifts are sent will not be able to claim them.", "anniversaryLimitedDates": "January 30th to February 8th", "limitedEvent": "Limited Event", diff --git a/website/common/script/content/constants/events.js b/website/common/script/content/constants/events.js index 067f7d6862..e1b8b53c94 100644 --- a/website/common/script/content/constants/events.js +++ b/website/common/script/content/constants/events.js @@ -76,23 +76,6 @@ export const REPEATING_EVENTS = { end: new Date('1970-08-02T03:59-04:00'), foodSeason: 'Cake', }, - fallGemFest: { - start: new Date('1970-09-23T04:00-04:00'), - end: new Date('1970-09-27T23:59-04:00'), - gemsPromo, - }, - spookyGemFest: { - start: new Date('1970-10-28T04:00-04:00'), - end: new Date('1970-11-01T23:59-04:00'), - gemsPromo, - }, - habitoween: { - start: new Date('1970-10-30T04:00-04:00'), - end: new Date('1970-11-01T23:59-04:00'), - foodSeason: 'Candy', - season: 'habitoween', - npcImageSuffix: '_halloween', - }, fallGemSale: { start: new Date('1970-09-23T04:00-04:00'), end: new Date('1970-09-27T23:59-04:00'), @@ -105,6 +88,13 @@ export const REPEATING_EVENTS = { event: 'spooky_extra_gems', gemsPromo, }, + habitoween: { + start: new Date('1970-10-30T04:00-04:00'), + end: new Date('1970-11-01T23:59-04:00'), + foodSeason: 'Candy', + season: 'habitoween', + npcImageSuffix: '_halloween', + }, harvestFeast: { start: new Date('1970-11-20T04:00-05:00'), end: new Date('1970-12-01T03:59-05:00'),