JSFiddle - React, Tailwind, and code Playground
by Chintan Upadhayay
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<ul class="dropdown-menu scrollable-menu" role="menu" id="ulContextMenuOnBehalf">
</ul>
JavaScript
var f = (SystemSettings.WeekNumbering == "Sunday" ? moment().startOf("week").isoWeekday(7) : moment().startOf("isoWeek"));
var d = (SystemSettings.WeekNumbering == "Sunday" ? moment().endOf("week").isoWeekday(6) : moment().endOf("isoWeek"));
if (SystemSettings.EnteringFutureTimesheets == "enabled") {
for (var l = 0; l < 2; l++) {
var r = (SystemSettings.WeekNumbering == "Sunday" ? moment().add(2 - l, "weeks").startOf("week").isoWeekday(7) : moment().add(2 - l, "weeks").startOf("isoWeek"));
var h = (SystemSettings.WeekNumbering == "Sunday" ? moment().add(2 - l, "weeks").endOf("week").isoWeekday(6) : moment().add(2 - l, "weeks").endOf("isoWeek"));
var s = (SystemSettings.WeekNumbering == "ISO" ? r.isoWeek() : r.week());
var t = "Week " + s + " (" + r.format(commonDateFormat2) + " - " + h.format(commonDateFormat2) + ")";
$("#ulContextMenu").append('<li><a class="dropdown-menu-link" onclick="GoToUrl(\'' + encodeURI(r.format(commonDateFormat2)) + '\')" + tabindex="-1">' + t + "</a></li>");
$("#ulContextMenuOnBehalf").append('<li><a class="dropdown-menu-link" onclick="GoToUrlOnBehalf(\'' + encodeURI(r.format(commonDateFormat2)) + '\')" + tabindex="-1">' + t + "</a></li>")
}
}
var g = "Current Week (" + f.format(commonDateFormat2) + " - " + d.format(commonDateFormat2) + ")";
$("#ulContextMenu").append('<li><a class="dropdown-menu-link" onclick="GoToUrl(\'' + encodeURI(f.format(commonDateFormat2)) + '\')" + tabindex="-1">' + g + "</a></li>");
$("#ulContextMenuOnBehalf").append('<li><a class="dropdown-menu-link" onclick="GoToUrlOnBehalf(\'' + encodeURI(f.format(commonDateFormat2)) + '\')" + tabindex="-1">' + g + "</a></li>");
for (var l = 1; l < 44; l++) {
var r = (SystemSettings.WeekNumbering == "Sunday" ? moment().subtract(l, "weeks").startOf("week").isoWeekday(7) : moment().subtract(l, "weeks").startOf("isoWeek"));
var h = (SystemSettings.WeekNumbering == "Sunday" ? moment().subtract(l,...