55
66<script setup lang="ts">
77import type { INode } from ' @nextcloud/files'
8+ import type { OCSResponse } from ' @nextcloud/typings/ocs'
89
910import { showError , showSuccess } from ' @nextcloud/dialogs'
1011import { emit as emitEventBus } from ' @nextcloud/event-bus'
11- import { t } from ' @nextcloud/l10n'
12- import { onBeforeMount , onMounted , ref } from ' vue'
12+ import { formatRelativeTime , t } from ' @nextcloud/l10n'
13+ import { computed , onBeforeMount , onMounted , ref } from ' vue'
1314import NcButton from ' @nextcloud/vue/components/NcButton'
14- import NcDateTime from ' @nextcloud/vue/components/NcDateTime'
1515import NcDateTimePickerNative from ' @nextcloud/vue/components/NcDateTimePickerNative'
1616import NcDialog from ' @nextcloud/vue/components/NcDialog'
1717import NcNoteCard from ' @nextcloud/vue/components/NcNoteCard'
@@ -33,6 +33,15 @@ const isValid = ref(true)
3333const customDueDate = ref <Date >()
3434const nowDate = ref (new Date ())
3535
36+ const informationText = computed (() => {
37+ const relativeDueDate = formatRelativeTime (customDueDate .value ?? 0 )
38+ return (nowDate .value .getTime () >= (customDueDate .value ?.getTime () ?? 0 ))
39+ // TRANSLATORS: {relativeDueDate} will be replaced with a relative time, e.g. "2 hours ago" or "in 3 days".
40+ ? t (' files_reminders' , ' We reminded you of this file {relativeDueDate}' , { relativeDueDate })
41+ // TRANSLATORS: {relativeDueDate} will be replaced with a relative time, e.g. "2 hours ago" or "in 3 days".
42+ : t (' files_reminders' , ' We will remind you of this file {relativeDueDate}' , { relativeDueDate })
43+ })
44+
3645onBeforeMount (() => {
3746 const dueDate = props .node .attributes [' reminder-due-date' ]
3847 ? new Date (props .node .attributes [' reminder-due-date' ])
@@ -132,8 +141,7 @@ function onInput(): void {
132141 @input =" onInput" />
133142
134143 <NcNoteCard v-if =" isValid && customDueDate" type =" info" >
135- {{ t('files_reminders', 'We will remind you of this file') }}
136- <NcDateTime :timestamp =" customDueDate" />
144+ {{ informationText }}
137145 </NcNoteCard >
138146
139147 <NcNoteCard v-else type =" error" >
0 commit comments