FEATURE: make date pickers in the bookmarks UI and topic timer UI consistent with all other pickers (#13365)

FEATURE: make date pickers in the bookmarks UI and topic timer UI consistent with all other pickers (#13365)

Next Week should mean next Monday, Next Month - the first day of the next month, and so on.

Also, we’ll be using the name “Next Monday” instead of “Next Week” because it’s easier to understand. No one can get confused by next Monday.

diff --git a/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.js b/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.js
index cb3ad39..65ab8b6 100644
--- a/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.js
+++ b/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.js
@@ -14,7 +14,12 @@ import I18n from "I18n";
 import { action } from "@ember/object";
 import Component from "@ember/component";
 import { isEmpty } from "@ember/utils";
-import { now, startOfDay, thisWeekend } from "discourse/lib/time-utils";
+import {
+  MOMENT_MONDAY,
+  now,
+  startOfDay,
+  thisWeekend,
+} from "discourse/lib/time-utils";
 import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
 import Mousetrap from "mousetrap";
 
@@ -82,22 +87,22 @@ export default Component.extend({
       {
         icon: "bed",
         id: "this_weekend",
-        label: "topic.auto_update_input.this_weekend",
+        label: "time_shortcut.this_weekend",
         time: thisWeekend(),
         timeFormatKey: "dates.time_short_day",
       },
       {
         icon: "far-clock",
         id: "two_weeks",
-        label: "topic.auto_update_input.two_weeks",
-        time: startOfDay(now().add(2, "weeks")),
+        label: "time_shortcut.two_weeks",
+        time: startOfDay(now().add(2, "weeks").day(MOMENT_MONDAY)),
         timeFormatKey: "dates.long_no_year",
       },
       {
         icon: "far-calendar-plus",
         id: "six_months",
-        label: "topic.auto_update_input.six_months",
-        time: startOfDay(now().add(6, "months")),
+        label: "time_shortcut.six_months",
+        time: startOfDay(now().add(6, "months").startOf("month")),
         timeFormatKey: "dates.long_no_year",
       },
     ];
@@ -105,7 +110,7 @@ export default Component.extend({
 
   @discourseComputed
   hiddenTimeShortcutOptions() {
-    return ["none", "start_of_next_business_week"];
+    return ["none"];
   },
 
   isCustom: equal("timerType", "custom"),
diff --git a/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js b/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js
index 69d4a43..7733cba 100644
--- a/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js
+++ b/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js
@@ -32,10 +32,6 @@ const BINDINGS = {
     handler: "selectShortcut",
     args: [TIME_SHORTCUT_TYPES.TOMORROW],
   },
-  "n w": {
-    handler: "selectShortcut",
-    args: [TIME_SHORTCUT_TYPES.NEXT_WEEK],
-  },
   "n b w": {
     handler: "selectShortcut",
     args: [TIME_SHORTCUT_TYPES.START_OF_NEXT_BUSINESS_WEEK],
diff --git a/app/assets/javascripts/discourse/app/controllers/keyboard-shortcuts-help.js b/app/assets/javascripts/discourse/app/controllers/keyboard-shortcuts-help.js
index f717a0f..eaf6510 100644
--- a/app/assets/javascripts/discourse/app/controllers/keyboard-shortcuts-help.js
+++ b/app/assets/javascripts/discourse/app/controllers/keyboard-shortcuts-help.js
@@ -151,10 +151,6 @@ export default Controller.extend(ModalFunctionality, {
           keys1: ["n", "d"],
           shortcutsDelimiter: "space",
         }),
-        next_week: buildShortcut("bookmarks.next_week", {
-          keys1: ["n", "w"],
-          shortcutsDelimiter: "space",
-        }),
         next_business_week: buildShortcut("bookmarks.next_business_week", {
           keys1: ["n", "b", "w"],
           shortcutsDelimiter: "space",
diff --git a/app/assets/javascripts/discourse/app/lib/time-shortcut.js b/app/assets/javascripts/discourse/app/lib/time-shortcut.js
index ddb4af4..d2eac0b 100644
--- a/app/assets/javascripts/discourse/app/lib/time-shortcut.js
+++ b/app/assets/javascripts/discourse/app/lib/time-shortcut.js
@@ -4,7 +4,6 @@ import {
   laterToday,
   nextBusinessWeekStart,
   nextMonth,
-  nextWeek,
   now,
   tomorrow,
 } from "discourse/lib/time-utils";
@@ -13,7 +12,6 @@ import I18n from "I18n";
 export const TIME_SHORTCUT_TYPES = {
   LATER_TODAY: "later_today",
   TOMORROW: "tomorrow",
-  NEXT_WEEK: "next_week",
   NEXT_MONTH: "next_month",
   CUSTOM: "custom",
   RELATIVE: "relative",
@@ -64,13 +62,6 @@ export function defaultShortcutOptions(timezone) {
       ),
     },
     {
-      icon: "far-clock",
-      id: TIME_SHORTCUT_TYPES.NEXT_WEEK,
-      label: "time_shortcut.next_week",
-      time: nextWeek(timezone),
-      timeFormatted: nextWeek(timezone).format(I18n.t("dates.long_no_year")),
-    },
-    {
       icon: "far-calendar-plus",
       id: TIME_SHORTCUT_TYPES.NEXT_MONTH,
       label: "time_shortcut.next_month",
diff --git a/app/assets/javascripts/discourse/app/lib/time-utils.js b/app/assets/javascripts/discourse/app/lib/time-utils.js
index 2597672..1f765ff 100644
--- a/app/assets/javascripts/discourse/app/lib/time-utils.js
+++ b/app/assets/javascripts/discourse/app/lib/time-utils.js
@@ -37,16 +37,12 @@ export function laterThisWeek(timezone) {
   return startOfDay(now(timezone).add(2, "days"));
 }
 
-export function nextWeek(timezone) {
-  return startOfDay(now(timezone).add(7, "days"));
-}
-
 export function nextMonth(timezone) {
-  return startOfDay(now(timezone).add(1, "month"));
+  return startOfDay(now(timezone).add(1, "month").startOf("month"));
 }
 
 export function nextBusinessWeekStart(timezone) {
-  return nextWeek(timezone).day(MOMENT_MONDAY);
+  return startOfDay(now(timezone).add(7, "days")).day(MOMENT_MONDAY);
 }
 
 export function parseCustomDatetime(
diff --git a/app/assets/javascripts/discourse/app/templates/modal/keyboard-shortcuts-help.hbs b/app/assets/javascripts/discourse/app/templates/modal/keyboard-shortcuts-help.hbs
index 5140803..9d3b182 100644
--- a/app/assets/javascripts/discourse/app/templates/modal/keyboard-shortcuts-help.hbs
+++ b/app/assets/javascripts/discourse/app/templates/modal/keyboard-shortcuts-help.hbs
@@ -64,7 +64,6 @@
         <li>{{html-safe shortcuts.bookmarks.later_today}}</li>
         <li>{{html-safe shortcuts.bookmarks.later_this_week}}</li>
         <li>{{html-safe shortcuts.bookmarks.tomorrow}}</li>
-        <li>{{html-safe shortcuts.bookmarks.next_week}}</li>
         <li>{{html-safe shortcuts.bookmarks.next_month}}</li>
         <li>{{html-safe shortcuts.bookmarks.next_business_week}}</li>
         <li>{{html-safe shortcuts.bookmarks.next_business_day}}</li>
diff --git a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js
index daf77ff..bab0ff7 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js
@@ -81,9 +81,6 @@ acceptance("Bookmarking", function (needs) {
     await click("#tap_tile_start_of_next_business_week");
 
     await openBookmarkModal();
-    await click("#tap_tile_next_week");
-
-    await openBookmarkModal();
     await click("#tap_tile_next_month");
 
     await openBookmarkModal();
@@ -96,7 +93,6 @@ acceptance("Bookmarking", function (needs) {
     assert.deepEqual(steps, [
       "tomorrow",
       "start_of_next_business_week",
-      "next_week",
       "next_month",
       "custom",
     ]);
diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js
index 0e3a35a..b064643 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js
@@ -1,14 +1,18 @@
 import {
   acceptance,
   exists,
+  fakeTime,
+  loggedInUser,
   queryAll,
   updateCurrentUser,
 } from "discourse/tests/helpers/qunit-helpers";
 import { click, fillIn, visit } from "@ember/test-helpers";
 import { test } from "qunit";
 import selectKit from "discourse/tests/helpers/select-kit-helper";
+import I18n from "I18n";
 
 acceptance("Topic - Edit timer", function (needs) {

[... diff too long, it was truncated ...]

GitHub sha: 00255d0bd215d4dec831c16b460f1d301c1fc6dc

This commit appears in #13365 which was approved by ZogStriP. It was merged by AndrewPrigorshnev.