Created
April 23, 2024 09:46
-
-
Save nikolaskhodov/7f360400faf907ca4b1917dc66fffbce to your computer and use it in GitHub Desktop.
Weekdays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (() => { | |
| 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