Skip to content

Commit

Permalink
fix: Shorten tooltip text by removing year - it's obvious from context
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed Dec 11, 2023
1 parent c150ace commit 4bf73ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Scripting/Postponer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function postponeMenuItemTitle(task: Task, amount: number, timeUnit: unit
const updatedDateDisplayText = capitalizeFirstLetter(updatedDateType.replace('Date', ''));

const postponedDate = new TasksDate(dateToUpdate).postpone(timeUnit, amount);
const formattedNewDate = postponedDate.format('ddd Do MMM, YYYY');
const formattedNewDate = postponedDate.format('ddd Do MMM');

const amountOrArticle = amount > 1 ? amount : 'a';
return `${updatedDateDisplayText} in ${amountOrArticle} ${timeUnit}, on ${formattedNewDate}`;
Expand Down
8 changes: 4 additions & 4 deletions tests/Scripting/Postponer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ describe('postpone - UI text', () => {
it('should include date type and new date in button tooltip', () => {
const task = new TaskBuilder().dueDate(today).build();
expect(postponeButtonTitle(task, 1, 'day')).toEqual(
'ℹ️ Due in a day, on Mon 4th Dec, 2023 (right-click for more options)',
'ℹ️ Due in a day, on Mon 4th Dec (right-click for more options)',
);
expect(postponeButtonTitle(task, 2, 'days')).toEqual(
'ℹ️ Due in 2 days, on Tue 5th Dec, 2023 (right-click for more options)',
'ℹ️ Due in 2 days, on Tue 5th Dec (right-click for more options)',
);
});

it('should include date type and new date in context menu labels', () => {
const task = new TaskBuilder().dueDate(today).build();
expect(postponeMenuItemTitle(task, 1, 'day')).toEqual('Due in a day, on Mon 4th Dec, 2023');
expect(postponeMenuItemTitle(task, 2, 'days')).toEqual('Due in 2 days, on Tue 5th Dec, 2023');
expect(postponeMenuItemTitle(task, 1, 'day')).toEqual('Due in a day, on Mon 4th Dec');
expect(postponeMenuItemTitle(task, 2, 'days')).toEqual('Due in 2 days, on Tue 5th Dec');
});
});

Expand Down

0 comments on commit 4bf73ff

Please sign in to comment.