diff --git a/src/components/TextField.vue b/src/components/TextField.vue index 82e9e37..d9bf3fc 100644 --- a/src/components/TextField.vue +++ b/src/components/TextField.vue @@ -1,13 +1,13 @@ diff --git a/src/lib/dates.js b/src/lib/dates.js new file mode 100644 index 0000000..5561411 --- /dev/null +++ b/src/lib/dates.js @@ -0,0 +1,5 @@ +import moment from "moment/moment"; + +export function formatDate(value) { + return moment(String(value)).format('YYYY-MM-DD'); +} diff --git a/src/main.js b/src/main.js index 1e93209..62e52ce 100644 --- a/src/main.js +++ b/src/main.js @@ -11,6 +11,7 @@ import 'vue-tour/dist/vue-tour.css' import './assets/css/main.css' import QrcodeVue from "qrcode.vue"; import moment from "moment/moment"; +import { formatDate } from "./lib/dates"; Vue.use(BootstrapVue) Vue.use(BootstrapVueIcons) @@ -28,9 +29,7 @@ Vue.filter('uppercase', function (value) { return value.toUpperCase(); }); -Vue.filter('formatDate', function (value) { - return moment(String(value)).format('YYYY-MM-DD hh:mm'); -}) +Vue.filter('formatDate', formatDate) Vue.filter('formatDateHumanize', function (value) { const now = new moment(); diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 76f1c07..5a2b2cc 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -49,7 +49,8 @@ Your shard will be deleted - {{ $store.state.profile.delete_after | formatDateHumanize }}. + {{ + $store.state.profile.delete_after | formatDateHumanize }}. That happens on its own if you do nothing: you are not charged, and there is nothing to cancel. @@ -89,7 +90,7 @@ incl. 19% VAT ({{ formatPrice(vatAmountEur($store.state.profile.subscription.price_cents)) }}) - Next charge {{ $store.state.profile.subscription.next_billing_date | formatDateHumanize }}. + Next charge: {{ $store.state.profile.subscription.next_billing_date | formatDate }}. Billed to {{ $store.state.profile.subscription.payer_email }}. @@ -120,18 +121,21 @@ @@ -235,7 +239,8 @@

Your passphrase was last revealed - {{ backupInfo.last_passphrase_access_info.time | formatDateHumanize }} + {{ + backupInfo.last_passphrase_access_info.time | formatDateHumanize }} from device {{ backupInfo.last_passphrase_access_info.terminal_name }} (with ID: {{ backupInfo.last_passphrase_access_info.terminal_id }}).

@@ -341,12 +346,15 @@ + :content="$store.state.profile.time_created | formatDateHumanize" + :tooltip="$store.state.profile.time_created | formatDate"/> + :content="$store.state.profile.time_assigned | formatDateHumanize" + :tooltip="$store.state.profile.time_assigned | formatDate"/>
+ :content="$store.state.profile.delete_after | formatDateHumanize" + :tooltip="$store.state.profile.delete_after | formatDate"/>
diff --git a/tests/unit/dates.spec.js b/tests/unit/dates.spec.js new file mode 100644 index 0000000..12608a5 --- /dev/null +++ b/tests/unit/dates.spec.js @@ -0,0 +1,12 @@ +import { formatDate } from '@/lib/dates'; + +describe('formatDate', () => { + test('renders the calendar day the charge falls on', () => { + expect(formatDate('2026-07-01T13:30:00')).toBe('2026-07-01'); + }); + + test('carries no clock time, which the billing line does not need', () => { + expect(formatDate('2026-07-01T13:30:00')) + .toBe(formatDate('2026-07-01T01:30:00')); + }); +});