MCPcopy
hub / github.com/callumalpass/tasknotes / getDateOptions

Method getDateOptions

src/components/DateContextMenu.ts:214–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212 }
213
214 public getDateOptions(): DateOption[] {
215 const today = getMoment();
216 const options: DateOption[] = [];
217
218 if (this.options.currentValue) {
219 options.push({
220 label: this.t("contextMenus.date.increment.plusOneDay", "+1 day"),
221 value: addDaysToDateTime(this.options.currentValue, 1),
222 icon: "plus",
223 category: "increment",
224 });
225 options.push({
226 label: this.t("contextMenus.date.increment.minusOneDay", "-1 day"),
227 value: addDaysToDateTime(this.options.currentValue, -1),
228 icon: "minus",
229 category: "increment",
230 });
231 options.push({
232 label: this.t("contextMenus.date.increment.plusOneWeek", "+1 week"),
233 value: addDaysToDateTime(this.options.currentValue, 7),
234 icon: "plus-circle",
235 category: "increment",
236 });
237 options.push({
238 label: this.t("contextMenus.date.increment.minusOneWeek", "-1 week"),
239 value: addDaysToDateTime(this.options.currentValue, -7),
240 icon: "minus-circle",
241 category: "increment",
242 });
243 }
244
245 options.push({
246 label: this.t("contextMenus.date.basic.today", "Today"),
247 value: today.format("YYYY-MM-DD"),
248 icon: "calendar-check",
249 isToday: true,
250 category: "basic",
251 });
252
253 options.push({
254 label: this.t("contextMenus.date.basic.tomorrow", "Tomorrow"),
255 value: today.clone().add(1, "day").format("YYYY-MM-DD"),
256 icon: "calendar-plus",
257 category: "basic",
258 });
259
260 const weekdayCodes = [
261 "Sunday",
262 "Monday",
263 "Tuesday",
264 "Wednesday",
265 "Thursday",
266 "Friday",
267 "Saturday",
268 ];
269 const firstDay = this.getFirstDayOfWeek();
270 const orderedWeekdayCodes = [
271 ...weekdayCodes.slice(firstDay),

Callers 4

addDateOptionsMethod · 0.95
buildMenuMethod · 0.95
addDateOptionsMethod · 0.95
getWeekdayLabelsFunction · 0.80

Calls 5

tMethod · 0.95
getFirstDayOfWeekMethod · 0.95
addDaysToDateTimeFunction · 0.90
isBeforeMethod · 0.80
getMomentFunction · 0.70

Tested by 1

getWeekdayLabelsFunction · 0.64