K
K
kirillleogky2020-05-10 13:31:57
JavaScript
kirillleogky, 2020-05-10 13:31:57

How can I find out the next dates of the week?

there is an array
const days = {
en: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
by: ['Nyad', 'Mon', ' Aut', 'Sun', 'Thu', 'Fri', 'Sat'],
ru: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
};
and here I find out the current number of the day of the week currDate.getDay()
turns out like this - days[`en`][currDate.getDay()] = 'Sun',

how can I constantly find out the next 3 days of the week?
such constructions are not very currDate.getDay() + 1 > 6 ? 0 : currDate.getDay() + 1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
origami1024, 2020-05-10
@kirillleogky

% 7

K
Karpion, 2020-05-10
@Karpion

If you need all three of the following days - then get them in turn.
If you need a distant day at once, then you need to take the number of the current day of the week; add to it as much as you need; and then take the remainder of the division by seven (@origami1024 as if hinting).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question