UI tweak for days remaining banner of free trial (#14764)

This commit is contained in:
melohagan 2024-10-11 07:39:03 +01:00 committed by GitHub
parent a1e55a5324
commit 402013bef3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -14,7 +14,13 @@
function daysUntilCancel() { function daysUntilCancel() {
const cancelAt = license?.billing?.subscription?.cancelAt const cancelAt = license?.billing?.subscription?.cancelAt
const diffTime = Math.abs(cancelAt - new Date().getTime()) / 1000 const diffTime = Math.abs(cancelAt - new Date().getTime()) / 1000
return Math.floor(diffTime / oneDayInSeconds) const days = Math.floor(diffTime / oneDayInSeconds)
if (days === 1) {
return "tomorrow."
} else if (days === 0) {
return "today."
}
return `in ${days} days.`
} }
</script> </script>
@ -28,7 +34,7 @@
extraLinkAction={$licensing.goToUpgradePage} extraLinkAction={$licensing.goToUpgradePage}
showCloseButton={false} showCloseButton={false}
> >
Your free trial will end in {daysUntilCancel()} days. Your free trial will end {daysUntilCancel()}
</Banner> </Banner>
</div> </div>
{/if} {/if}