UNPKG
@ipohjs/calendar
Version:
latest (0.1.0-rc.8)
rc (0.1.0-rc.0)
0.1.0-rc.8
0.1.0-rc.7
0.1.0-rc.6
0.1.0-rc.5
0.1.0-rc.4
0.1.0-rc.3
0.1.0-rc.2
0.1.0-rc.1
0.1.0-rc.0
Minimal module to compute a calendar
github.com/ipohjs/webmod/packages/calendar
ipohjs/webmod
@ipohjs/calendar
/
dist
/
helpers
/
to-valid-weekday.js
7 lines
•
279 B
JavaScript
View Raw
1
2
3
4
5
6
7
export
function
toValidWeekday
(
weekday
) {
if
(weekday >=
0
&& weekday <
7
)
return
Math
.
abs
(weekday);
const
weekdayOffset = weekday <
0
?
7
*
Math
.
ceil
(
Math
.
abs
(weekday)) :
0
;
return
(weekdayOffset + weekday) %
7
; }
//# sourceMappingURL=to-valid-weekday.js.map