From 30842fa9690b93b61ba459e40bce3b3f167974fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 8 Nov 2023 12:58:29 +0100 Subject: [PATCH] fix: Show tooltip for readable date MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/card/DueDateSelector.vue | 4 +++ src/mixins/readableDate.js | 33 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/mixins/readableDate.js diff --git a/src/components/card/DueDateSelector.vue b/src/components/card/DueDateSelector.vue index a068d8bde..29bf8ae98 100644 --- a/src/components/card/DueDateSelector.vue +++ b/src/components/card/DueDateSelector.vue @@ -29,6 +29,7 @@ import { defineComponent } from 'vue' import { NcActionButton, NcActions, NcDatetimePicker } from '@nextcloud/vue' import { getDayNamesMin, getFirstDay, getMonthNamesShort } from '@nextcloud/l10n' import Calendar from 'vue-material-design-icons/Calendar.vue' +import readableDate from '../../mixins/readableDate.js' export default defineComponent({ name: 'DueDateSelector', @@ -38,6 +39,9 @@ export default defineComponent({ NcActionButton, NcDatetimePicker, }, + mixins: [ + readableDate, + ], props: { card: { type: Object, diff --git a/src/mixins/readableDate.js b/src/mixins/readableDate.js new file mode 100644 index 000000000..3205431f5 --- /dev/null +++ b/src/mixins/readableDate.js @@ -0,0 +1,33 @@ +/* + * @copyright Copyright (c) 2020 Julius Härtl + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +import moment from '@nextcloud/moment' + +export default { + computed: { + formatReadableDate() { + return (timestamp) => { + return moment(timestamp).format('lll') + } + }, + }, +}