@gez/date-time-kit
Version:
16 lines (15 loc) • 313 B
JavaScript
export const weekKey = [
"sun",
"mon",
"tue",
"wed",
"thu",
"fri",
"sat"
];
export const getWeekInOrder = (startAt) => {
if (!startAt) startAt = "sun";
const index = weekKey.indexOf(startAt);
if (index === -1) return weekKey;
return [...weekKey.slice(index), ...weekKey.slice(0, index)];
};