summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/lib
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-02-11 09:11:27 +0100
committerOskar Nyberg <oskar@mullvad.net>2020-02-11 09:11:27 +0100
commita15f9a329564d0b6638c0b9923b3af7326f236e1 (patch)
tree2bf5396b4cd93baa1b551e74b60d8f9a4a5ce493 /gui/src/renderer/lib
parentc9b3e7f007b0dd340ea810bca05abef36a325b7f (diff)
parent83a1b073c6616330fa48468deaa13ade13ed711c (diff)
downloadmullvadvpn-a15f9a329564d0b6638c0b9923b3af7326f236e1.tar.xz
mullvadvpn-a15f9a329564d0b6638c0b9923b3af7326f236e1.zip
Merge branch 'short-time-left-notification'
Diffstat (limited to 'gui/src/renderer/lib')
-rw-r--r--gui/src/renderer/lib/account-expiry.ts35
1 files changed, 0 insertions, 35 deletions
diff --git a/gui/src/renderer/lib/account-expiry.ts b/gui/src/renderer/lib/account-expiry.ts
deleted file mode 100644
index 5393238dcd..0000000000
--- a/gui/src/renderer/lib/account-expiry.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import moment from 'moment';
-import { sprintf } from 'sprintf-js';
-import { messages } from '../../shared/gettext';
-
-export default class AccountExpiry {
- private expiry: moment.Moment;
-
- constructor(isoString: string, locale: string) {
- this.expiry = moment(isoString).locale(locale);
- }
-
- public hasExpired(): boolean {
- return this.willHaveExpiredAt(new Date());
- }
-
- public willHaveExpiredAt(date: Date): boolean {
- return this.expiry.isSameOrBefore(date);
- }
-
- public formattedDate(): string {
- return this.expiry.format('L LTS');
- }
-
- public remainingTime(): string {
- const duration = this.expiry.fromNow(true);
-
- return sprintf(
- // TRANSLATORS: The remaining time left on the account displayed across the app.
- // TRANSLATORS: Available placeholders:
- // TRANSLATORS: %(duration)s - a localized remaining time (in minutes, hours, or days) until the account expiry
- messages.pgettext('account-expiry', '%(duration)s left'),
- { duration },
- );
- }
-}