From 7e210c56b08e4f59bbb7d8247f3261a0fa93fdd2 Mon Sep 17 00:00:00 2001 From: CuriousMagpie Date: Thu, 4 May 2023 16:29:54 -0400 Subject: [PATCH 1/7] fix(to do dates): change formatDueDate () to show exact due dates --- website/client/src/components/tasks/task.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/website/client/src/components/tasks/task.vue b/website/client/src/components/tasks/task.vue index 520c51568c..ed3bfa32ea 100644 --- a/website/client/src/components/tasks/task.vue +++ b/website/client/src/components/tasks/task.vue @@ -1128,10 +1128,7 @@ export default { return this.calculateTimeTillDue().asDays() <= 0; }, formatDueDate () { - const timeTillDue = this.calculateTimeTillDue(); - const dueIn = timeTillDue.asDays() === 0 ? this.$t('today') : timeTillDue.humanize(true); - - return this.task.date && this.$t('dueIn', { dueIn }); + return moment(this.task.date).format(this.user.preferences.dateFormat.toUpperCase()); }, edit (e, task) { if (this.isRunningYesterdailies) return; From 0e0cd99ded24d03d4d2873ddc3cac3ece4dcdaef Mon Sep 17 00:00:00 2001 From: CuriousMagpie Date: Thu, 4 May 2023 16:35:27 -0400 Subject: [PATCH 2/7] fix(to do dates): Add the word "Due" to the HTML --- website/client/src/components/tasks/task.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/client/src/components/tasks/task.vue b/website/client/src/components/tasks/task.vue index ed3bfa32ea..86dc665e1e 100644 --- a/website/client/src/components/tasks/task.vue +++ b/website/client/src/components/tasks/task.vue @@ -243,7 +243,7 @@ class="svg-icon calendar" v-html="icons.calendar" > - {{ formatDueDate() }} + Due {{ formatDueDate() }}
Date: Thu, 4 May 2023 16:40:11 -0400 Subject: [PATCH 3/7] fix(to do dates): locate a string for "Due" --- website/client/src/components/tasks/task.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/client/src/components/tasks/task.vue b/website/client/src/components/tasks/task.vue index 86dc665e1e..1efd89a5fb 100644 --- a/website/client/src/components/tasks/task.vue +++ b/website/client/src/components/tasks/task.vue @@ -243,7 +243,7 @@ class="svg-icon calendar" v-html="icons.calendar" >
- Due {{ formatDueDate() }} + {{ $t('due') }} {{ formatDueDate() }}
Date: Tue, 16 May 2023 14:15:34 -0500 Subject: [PATCH 4/7] fix(test): include user pref needed for date --- website/client/tests/unit/components/tasks/task.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/client/tests/unit/components/tasks/task.spec.js b/website/client/tests/unit/components/tasks/task.spec.js index 9349d7ea2f..5ad0e9e3fa 100644 --- a/website/client/tests/unit/components/tasks/task.spec.js +++ b/website/client/tests/unit/components/tasks/task.spec.js @@ -22,7 +22,9 @@ describe('Task', () => { state: { user: { data: { - preferences: {}, + preferences: { + dateFormat: 'MM/dd/yyyy', + }, ...additionalUserData, }, }, From a71e44b3312cf4804132dfe4e0122c38be63fd14 Mon Sep 17 00:00:00 2001 From: SabreCat Date: Tue, 16 May 2023 14:27:15 -0500 Subject: [PATCH 5/7] fix(test): remove test for old function --- .../tests/unit/components/tasks/task.spec.js | 90 ------------------- 1 file changed, 90 deletions(-) delete mode 100644 website/client/tests/unit/components/tasks/task.spec.js diff --git a/website/client/tests/unit/components/tasks/task.spec.js b/website/client/tests/unit/components/tasks/task.spec.js deleted file mode 100644 index 5ad0e9e3fa..0000000000 --- a/website/client/tests/unit/components/tasks/task.spec.js +++ /dev/null @@ -1,90 +0,0 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; -import moment from 'moment'; - -import Task from '@/components/tasks/task.vue'; -import Store from '@/libs/store'; - -const localVue = createLocalVue(); -localVue.use(Store); - -describe('Task', () => { - let wrapper; - - function makeWrapper (additionalTaskData = {}, additionalUserData = {}) { - return shallowMount(Task, { - propsData: { - task: { - group: {}, - ...additionalTaskData, - }, - }, - store: { - state: { - user: { - data: { - preferences: { - dateFormat: 'MM/dd/yyyy', - }, - ...additionalUserData, - }, - }, - }, - getters: { - 'tasks:getTaskClasses': () => ({}), - 'tasks:canEdit': () => ({}), - 'tasks:canDelete': () => ({}), - }, - }, - mocks: { $t: (key, params) => key + (params ? JSON.stringify(params) : '') }, - directives: { 'b-tooltip': {} }, - localVue, - }); - } - - it('returns a vue instance', () => { - wrapper = makeWrapper(); - expect(wrapper.isVueInstance()).to.be.true; - }); - - describe('Due date calculation', () => { - let clock; - - function setClockTo (time) { - const now = moment(time); - clock = sinon.useFakeTimers(now.toDate()); - return now; - } - - afterEach(() => { - clock.restore(); - }); - - it('formats due date to today if due today', () => { - const now = setClockTo('2019-09-17T17:57:00+02:00'); - wrapper = makeWrapper({ date: now }); - - expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"today"}'); - }); - - it('formats due date to tomorrow if due tomorrow', () => { - const now = setClockTo('2012-06-12T14:17:28Z'); - wrapper = makeWrapper({ date: now.add(1, 'day') }); - - expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"in a day"}'); - }); - - it('formats due date to 5 days if due in 5 days', () => { - const now = setClockTo(); - wrapper = makeWrapper({ date: now.add(5, 'days') }); - - expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"in 5 days"}'); - }); - - it('formats due date to tomorrow if today but before dayStart', () => { - const now = setClockTo('2019-06-12T04:23:37+02:00'); - wrapper = makeWrapper({ date: now.add(8, 'hours') }, { preferences: { dayStart: 7 } }); - - expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"in a day"}'); - }); - }); -}); From 7c1c18a329afca149a8679302b998c6fb3c784de Mon Sep 17 00:00:00 2001 From: CuriousMagpie Date: Wed, 17 May 2023 13:29:26 -0400 Subject: [PATCH 6/7] fix(styling): update colors to be a11y-friendly and to show items due today in gray --- website/client/src/components/tasks/task.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/client/src/components/tasks/task.vue b/website/client/src/components/tasks/task.vue index 1efd89a5fb..82296d423d 100644 --- a/website/client/src/components/tasks/task.vue +++ b/website/client/src/components/tasks/task.vue @@ -700,7 +700,7 @@ .icons { margin-top: 4px; - color: $gray-300; + color: $gray-100; font-style: normal; &-right { @@ -759,7 +759,7 @@ } .due-overdue { - color: $red-50; + color: $maroon-10; } .calendar.svg-icon { @@ -899,6 +899,7 @@ +