Skip to content

Instantly share code, notes, and snippets.

@nikolaskhodov
Created April 23, 2024 09:46
Show Gist options
  • Select an option

  • Save nikolaskhodov/7f360400faf907ca4b1917dc66fffbce to your computer and use it in GitHub Desktop.

Select an option

Save nikolaskhodov/7f360400faf907ca4b1917dc66fffbce to your computer and use it in GitHub Desktop.
Weekdays
(() => {
const DAY = 3600 * 1000 * 24;
const today = new Date();
const monday = today.getTime() + (1 /* Monday */ - today.getDay()) * DAY;
const weekdays = [
"sun",
"mon",
"tue",
"wed",
"thu",
"fri",
"sat"
];
const days = Array.from({ length: 7 }).map((_, index) => {
const day = new Date(monday + index * DAY);
return `${day.getDate()}.${day.getMonth() + 1} (${weekdays[day.getDay()]}) `;
});
const records = ["------- ( --> / )", ...days.reverse(), "-------\n", ""];
console.log(records.join("\n"));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment