/**
 * Date-fns utilities.
 */
import { zhCN } from 'date-fns/esm/locale';
import { format, startOfWeek, endOfWeek, startOfDay, eachDayOfInterval } from 'date-fns';
/** weekdays */
export var Weekday;
(function (Weekday) {
    Weekday[Weekday["Sunday"] = 0] = "Sunday";
    Weekday[Weekday["Monday"] = 1] = "Monday";
    Weekday[Weekday["Tuesday"] = 2] = "Tuesday";
    Weekday[Weekday["Wensday"] = 3] = "Wensday";
    Weekday[Weekday["Thursday"] = 4] = "Thursday";
    Weekday[Weekday["Friday"] = 5] = "Friday";
    Weekday[Weekday["Saturday"] = 6] = "Saturday";
})(Weekday || (Weekday = {}));
/**
 * get week day names, such as '日'，'一'， '二'，'六'
 */
export function getDayNames(weekStartsOn) {
    return getCurrentWeekArray(new Date(), weekStartsOn)
        .map(function (day) { return format(day, 'EEEEE', { locale: zhCN }); });
}
/*
 * get current date's week start date and end date
 */
export function getCurrentWeekArray(day, weekStartsOn) {
    return eachDayOfInterval({ start: startOfWeek(day, { weekStartsOn: weekStartsOn }), end: endOfWeek(day, { weekStartsOn: weekStartsOn }) }, { step: 1 });
}
/**
 * reset hours/minutes/seconds/milliseconds to zero
 */
export function resetTime(day) {
    return startOfDay(day);
}
/**
 * Return the start of a week for the given date. The result will be in the local timezone.
 */
export function getStartOfWeek(day) {
    return startOfWeek(day, { weekStartsOn: 1 });
}
/**
 * clone date, return a brand new reference
 */
export function cloneDate(day) {
    return new Date(day);
}
//# sourceMappingURL=date.js.map