package com.hzs.common.core.utils;

import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.core.codec.Base64Encoder;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * 时间工具类
 *
 * @author hzs
 */
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {

    public static final String YYYY = "yyyy";

    public static final String YYYY_MM = "yyyy-MM";

    public static final String YAMMER = "yyyyMMdd";

    public static final String YYYY_MM_DD = "yyyy-MM-dd";

    public static final String YAMMERERS = "yyyyMMddHHmmss";

    public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

    private static final String[] parsePatterns = {
            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
            "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
            "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};

    /**
     * 日期路径 即年/月/日 如2018/08/08
     */
    public static String datePath() {
        Date now = new Date();
        return DateFormatUtils.format(now, "yyyy/MM/dd");
    }

    /**
     * 日期型字符串转化为日期 格式
     */
    public static Date parseDate(Object str) {
        if (str == null) {
            return null;
        }
        try {
            return parseDate(str.toString(), parsePatterns);
        } catch (ParseException e) {
            return null;
        }
    }

    /**
     * 日期型字符串转化为指定日期格式
     *
     * @param str
     * @param format
     * @return
     */
    public static Date parseDateOne(Object str, String format) {
        if (str == null) {
            return null;
        }
        try {
            return parseDate(str.toString(), format);
        } catch (ParseException e) {
            return null;
        }
    }

    /**
     * 增加 LocalDateTime ==> Date
     */
    public static Date toDate(LocalDateTime temporalAccessor) {
        ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
        return Date.from(zdt.toInstant());
    }

    /**
     * 增加 LocalDate ==> Date
     */
    public static Date toDate(LocalDate temporalAccessor) {
        LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
        ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
        return Date.from(zdt.toInstant());
    }

    /**
     * date转换未LocalDateTime
     *
     * @param date 时间
     * @return LocalDateTime
     */
    public static LocalDateTime toLocalDateTime(Date date) {
        return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
    }

    /**
     * date转换未LocalDate
     *
     * @param date 时间
     * @return LocalDate
     */
    public static LocalDate toLocalDate(Date date) {
        return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
    }

    /**
     * 获取当前日期 年月日
     *
     * @return Date
     */
    public static Date currentDate() {
        return toDate(LocalDate.now());
    }

    /**
     * 获取当前日期 年月日 时分秒
     *
     * @return Integer
     */
    public static Date currentDateTime() {
        return toDate(LocalDateTime.now());
    }

    /**
     * 获取年
     *
     * @return Integer
     */
    public static Integer currentYear(Date... date) {
        LocalDate today = getLocalDate(date);
        return today.getYear();
    }

    /**
     * 获取月
     *
     * @return Integer
     */
    public static Integer currentMonth(Date... date) {
        LocalDate today = getLocalDate(date);
        return today.getMonthValue();
    }

    /**
     * @param date 日
     * @Description: 截取字符串，转换为月
     * @return: String
     * @Author: sui q
     * @Date: 2022/11/7 15:50
     */
    public static String getMonth(String date) {
        return date.replace("-", "").substring(0, 6);
    }

    /**
     * @param date 日
     * @Description: 截取字符串，转换为年
     * @return: String
     * @Author: sui q
     * @Date: 2022/11/7 15:50
     */
    public static String getYear(String date) {
        return date.substring(0, 4);
    }

    /**
     * 获取当前日期，或者转换date
     *
     * @return Integer
     */
    public static Integer currentDay(Date... date) {
        LocalDate today = getLocalDate(date);
        return today.getDayOfMonth();
    }

    /**
     * 根据年月日获取日期
     *
     * @param year  年
     * @param month 月
     * @param day   日
     * @return Date
     */
    public static Date getDateByCondition(Integer year, Integer month, Integer day) {
        LocalDate localDate = LocalDate.of(year, month, day);
        return toDate(localDate);
    }

    /**
     * 比较2个时间大小
     *
     * @param date1 第一个日期
     * @param date2 第二个日期
     * @return Integer
     */
    public static Integer compareDate(Date date1, Date date2) {
        return toLocalDateTime(date1).compareTo(toLocalDateTime(date2));
    }

    /**
     * 比较2个日期是否相等
     *
     * @param date1 第一个日期
     * @param date2 第二个日期
     * @return Boolean
     */
    public static Boolean compareDateEqual(Date date1, Date date2) {
        if (toLocalDate(date1).isEqual(toLocalDate(date2))) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }

    /**
     * 判断第一个日期在前面 第一个小
     *
     * @param date1 第一个日期
     * @param date2 第二个日期
     * @return Boolean
     */
    public static Boolean compareDateBefore(Date date1, Date date2) {
        return toLocalDate(date1).isBefore(toLocalDate(date2));
    }

    /**
     * 判断第一个日期在后面 第一个大
     *
     * @param date1 第一个日期
     * @param date2 第二个日期
     * @return Boolean
     */
    public static Boolean compareDateAfter(Date date1, Date date2) {
        return toLocalDate(date1).isAfter(toLocalDate(date2));
    }

    /**
     * 判断第一个日期在后面 第一个大
     *
     * @param date1 第一个日期
     * @param date2 第二个日期
     * @return Boolean
     */
    public static Boolean compareDateTimeAfter(Date date1, Date date2) {
        return toLocalDateTime(date1).isAfter(toLocalDateTime(date2));
    }


    /**
     * 判断是否为闰年
     *
     * @param date 日期
     * @return Boolean
     */
    public static Boolean isLeapYear(Date... date) {
        LocalDate localDate = getLocalDate(date);
        return localDate.isLeapYear();
    }

    /**
     * 检查当年日期是否是生日
     *
     * @param birthDate 出生日期
     * @return Boolean
     */
    public static Boolean checkBirthDate(Date birthDate) {
        LocalDate nowDate = LocalDate.now();
        LocalDate validDate = toLocalDate(birthDate);
        MonthDay birthday = MonthDay.of(validDate.getMonth(), validDate.getDayOfMonth());
        MonthDay currentMonthDay = MonthDay.from(nowDate);
        // 验证日期
        if (currentMonthDay.equals(birthday)) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }

    /**
     * 获得之前月份的最后一天
     *
     * @param date 日期
     * @return string
     */
    public static String beforeMonthLastDateStr(Date... date) {
        LocalDate localDate = getLocalDate(date);
        LocalDate beforeMonthDate = localDate.minusMonths(1);
        return beforeMonthDate.with(TemporalAdjusters.lastDayOfMonth()).toString();
    }

    /**
     * 获得之前月份的最后一天
     *
     * @param date 日期
     * @return string
     */
    public static Date beforeMonthLastDate(Date... date) {
        LocalDate localDate = getLocalDate(date);
        LocalDate beforeMonthDate = localDate.minusMonths(1);
        return toDate(beforeMonthDate.with(TemporalAdjusters.lastDayOfMonth()));
    }

    private static LocalDate getLocalDate(Date[] date) {
        LocalDate localDate = LocalDate.now();
        if (date.length > 0) {
            localDate = toLocalDate(date[0]);
        }
        return localDate;
    }

    private static LocalDateTime getLocalDateTime(Date[] date) {
        LocalDateTime localDateTime = LocalDateTime.now();
        if (date.length > 0) {
            localDateTime = toLocalDateTime(date[0]);
        }
        return localDateTime;
    }

    /**
     * 获得之前月份的第一天
     *
     * @param date 日期
     * @return string
     */
    public static String beforeMonthFirstDateStr(Date... date) {
        LocalDate localDate = getLocalDate(date);
        LocalDate beforeMonthDate = localDate.minusMonths(1);
        return beforeMonthDate.with(TemporalAdjusters.firstDayOfMonth()).toString();
    }


    /**
     * 获得之前月份的第一天
     *
     * @param date 日期
     * @return string
     */
    public static String beforeMonthFirstDateStr(Integer number, Date... date) {
        LocalDate localDate = getLocalDate(date);
        LocalDate beforeMonthDate = localDate.minusMonths(number);
        return beforeMonthDate.with(TemporalAdjusters.firstDayOfMonth()).toString();
    }


    /**
     * 获得之前月份的第一天
     *
     * @param date 日期
     * @return string
     */
    public static Date beforeMonthFirstDate(Date... date) {
        LocalDate localDate = getLocalDate(date);
        LocalDate beforeMonthDate = localDate.minusMonths(1);
        return toDate(beforeMonthDate.with(TemporalAdjusters.firstDayOfMonth()));
    }

    /**
     * 获得当前月份的第一天
     *
     * @param date 日期
     * @return string
     */
    public static String currentMonthFirstDateStr(Date... date) {
        LocalDate localDate = getLocalDate(date);
        return localDate.with(TemporalAdjusters.firstDayOfMonth()).toString();
    }

    /**
     * 获得当前月份的第一天
     *
     * @param date 日期
     * @return string
     */
    public static Date currentMonthFirstDate(Date... date) {
        LocalDate localDate = getLocalDate(date);
        return toDate(localDate.with(TemporalAdjusters.firstDayOfMonth()));
    }

    /**
     * 获得当前月份的最后一天
     *
     * @param date 日期
     * @return string
     */
    public static String currentMonthLastDateStr(Date... date) {
        LocalDate localDate = getLocalDate(date);
        return localDate.with(TemporalAdjusters.lastDayOfMonth()).toString();
    }

    /**
     * 获得当前月份的最后一天
     *
     * @param date 日期
     * @return string
     */
    public static Date currentMonthLastDate(Date... date) {
        LocalDate localDate = getLocalDate(date);
        return toDate(localDate.with(TemporalAdjusters.lastDayOfMonth()));
    }

    /**
     * 根据条件获取数量后的日期，按照 天、周、月、年
     *
     * @param number  数量
     * @param chrUnit DAYS/天 WEEKS/周 MONTHS/月 YEARS/年
     * @return Date
     */
    public static Date afterDate(Integer number, ChronoUnit chrUnit, Date... date) {
        LocalDate today = getLocalDate(date);
        return toDate(today.plus(number, chrUnit));
    }

    /**
     * 根据条件获取数量后的日期，按照 天、周、月、年
     *
     * @param number  数量
     * @param chrUnit DAYS/天 WEEKS/周 MONTHS/月 YEARS/年
     * @return Date
     */
    public static Date afterDateTime(Integer number, ChronoUnit chrUnit, Date... date) {
        LocalDateTime today = getLocalDateTime(date);
        return toDate(today.plus(number, chrUnit));
    }

    /**
     * 根据条件获取数量前的日期，按照 天、周、月、年
     *
     * @param number  数量
     * @param chrUnit DAYS/天 WEEKS/周 MONTHS/月 YEARS/年
     * @return Date
     */
    public static Date beforeDate(Integer number, ChronoUnit chrUnit, Date... date) {
        LocalDate today = getLocalDate(date);
        return toDate(today.minus(number, chrUnit));
    }

    /**
     * 根据条件获取数量前的日期，按照 天、周、月、年
     *
     * @param number  数量
     * @param chrUnit DAYS/天 WEEKS/周 MONTHS/月 YEARS/年
     * @return Date
     */
    public static String beforeDateStr(Integer number, ChronoUnit chrUnit, String format, String date) {
        return parseDateToStr(format, beforeDate(number, chrUnit, parseStringToDate(date)));
    }

    /**
     * 根据条件获取数量前的日期，按照 天、周、月、年
     *
     * @param number  数量
     * @param chrUnit DAYS/天 WEEKS/周 MONTHS/月 YEARS/年
     * @return Date
     */
    public static String beforeDateStr(Integer number, ChronoUnit chrUnit, String format, Date date) {
        return parseDateToStr(format, beforeDate(number, chrUnit, date));
    }

    /**
     * 获得2个日期总共差的天数
     *
     * @param date1 第一个日期
     * @param date  第二个日期
     * @return Integer
     */
    public static Integer betweenDay(Date date1, Date... date) {
        LocalDate today = getLocalDate(date);
        return ((Long) toLocalDate(date1).until(today, ChronoUnit.DAYS)).intValue();
    }

    /**
     * 计算2个日期之间的天数
     *
     * @param date1 日期
     * @param date  日期2
     * @return Integer
     */
    public static Boolean betweenMonth(Date date1, Date... date) {
        LocalDate localDate = LocalDate.now();
        if (date.length > 0) {
            localDate = toLocalDate(date[0]);
        }
        LocalDate localDate1 = toLocalDate(date1);
        if (localDate.getMonth() == localDate1.getMonth()) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }

    /**
     * 计算2个日期之间的天数
     *
     * @param date1 日期
     * @param date  日期2
     * @return Integer
     */
    public static Long betweenSecond(Date date1, Date... date) {
        LocalDateTime startDateTime = toLocalDateTime(date1);
        LocalDateTime localDateTime = LocalDateTime.now();
        if (date.length > 0) {
            localDateTime = toLocalDateTime(date[0]);
        }
        long startSecond = startDateTime.toEpochSecond(ZoneOffset.ofHours(0));
        long currentSecond = localDateTime.toEpochSecond(ZoneOffset.ofHours(0));
        return Math.abs(startSecond - currentSecond);
    }

    /**
     * 计算2个日期之间相差具体的年月日
     *
     * @param date1 第一个日期
     * @param date  第二个日期
     * @return Period
     */
    public static Period betweenPeriod(Date date1, Date... date) {
        LocalDate today = getLocalDate(date);
        return Period.between(today, toLocalDate(date1));
    }

    /**
     * 字符串date转换为Date 类型
     *
     * @param date 需要转换的值
     * @return Date
     */
    public static Date parseStringToDate(final String date) {
        LocalDate parse = LocalDate.parse(date);
        return toDate(parse);
    }

    /**
     * 字符串date转换为Date 类型
     *
     * @param date 需要转换的值
     * @return Date
     */
    public static Date parseStringToDateTime(final String date) {
        DateTimeFormatter df = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
        LocalDateTime parse = LocalDateTime.parse(date, df);
        return toDate(parse);
    }

    /**
     * 将日期格式转换为字符串格式
     *
     * @param format 转换的格式
     * @param date   需要转换的日期
     * @return String
     */
    public static String parseDateToStr(final String format, Date... date) {
        LocalDate today = getLocalDate(date);
        return today.format(DateTimeFormatter.ofPattern(format));
    }

    /**
     * 将时间格式转换为字符串格式
     *
     * @param format 转换的格式
     * @param date   需要转换的日期
     * @return String
     */
    public static String parseDateTimeToStr(final String format, Date... date) {
        LocalDateTime today = LocalDateTime.now();
        if (date.length > 0) {
            today = toLocalDateTime(date[0]);
        }
        return today.format(DateTimeFormatter.ofPattern(format));
    }

    public static long parseDateToSecond(Date... date) {
        LocalDateTime today = LocalDateTime.now();
        if (date.length > 0) {
            today = toLocalDateTime(date[0]);
        }
        return today.atZone(ZoneId.systemDefault()).toEpochSecond();
    }

    /**
     * 查询开始时间
     *
     * @return Date
     */
    public static Date getStartTime(Date date) {
        Calendar todayStart = Calendar.getInstance();
        if (null != date) {
            todayStart.setTime(date);
        }
        todayStart.set(Calendar.HOUR_OF_DAY, 0);
        todayStart.set(Calendar.MINUTE, 0);
        todayStart.set(Calendar.SECOND, 0);
        todayStart.set(Calendar.MILLISECOND, 0);
        return todayStart.getTime();
    }

    /**
     * 查询结束时间
     *
     * @return Date
     */
    public static Date getEndTime(Date date) {
        Calendar todayEnd = Calendar.getInstance();
        if (null != date) {
            todayEnd.setTime(date);
        }
        todayEnd.set(Calendar.HOUR_OF_DAY, 23);
        todayEnd.set(Calendar.MINUTE, 59);
        todayEnd.set(Calendar.SECOND, 59);
        todayEnd.set(Calendar.MILLISECOND, 999);
        return todayEnd.getTime();
    }

    /**
     * 处理开始结束时间
     *
     * @param date
     * @return
     */
    public static Date[] handTimeStartAndEnd(Date[] date) {
        if (null != date && date.length == 2) {
            date[0] = DateUtils.getStartTime(date[0]);
            date[1] = DateUtils.getEndTime(date[1]);
        }
        return date;
    }

    public static String parseDateToFormat(final String format, final Date date) {
        return new SimpleDateFormat(format).format(date);
    }

    /**
     * 获取时间差显示
     *
     * @param date1 被减时间
     * @param date2 减时间
     * @return
     */
    public static String getDateDifferenceVal(Date date1, Date date2) {
        if (null == date1 || null == date2) {
            return "";
        }
        // 两个时间的秒差
        long diff = (date1.getTime() - date2.getTime()) / 1000;
        long hour = diff / (60 * 60);
        long min = diff / (60) - hour * 60;
        long second = diff - hour * 60 * 60 - min * 60;

        String str = "";
        if (hour != 0) {
            str += hour + "小时";
        }
        if (min != 0) {
            str += min + "分";
        }
        if (second != 0) {
            str += second + "秒";
        }

        return str;
    }

    /**
     * 加减天数 获取时间
     *
     * @param date
     * @param number
     * @return
     */
    public static String getDay(Date date, Integer number) {
        Calendar instance = Calendar.getInstance();
        instance.setTime(date);
        instance.add(Calendar.DATE, number);
        return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, instance.getTime());
    }

    /**
     * 加减天数 获取时间
     *
     * @param date
     * @param number
     * @return
     */
    public static Date addDate(Date date, Integer number) {
        Calendar instance = Calendar.getInstance();
        instance.setTime(date);
        instance.add(Calendar.DATE, number);
        return instance.getTime();
    }

    /**
     * 获取两个时间内的每一天
     *
     * @param startTime
     * @param endTime
     * @return
     */
    public static List findDaysStr(String startTime, String endTime) {

        SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.YYYY_MM_DD);
        Date dBegin = null;
        Date dEnd = null;
        try {
            dBegin = sdf.parse(startTime);
            dEnd = sdf.parse(endTime);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        List daysStrList = new ArrayList();
        daysStrList.add(sdf.format(dBegin));
        Calendar calBegin = Calendar.getInstance();
        calBegin.setTime(dBegin);
        Calendar calEnd = Calendar.getInstance();
        calEnd.setTime(dEnd);

        while (dEnd.after(calBegin.getTime())) {
            calBegin.add(Calendar.DAY_OF_MONTH, 1);
            String dayStr = sdf.format(calBegin.getTime());
            daysStrList.add(dayStr);
        }
        return daysStrList;
    }

    /**
     * 计算当前日期前n天的日期
     *
     * @param n 天数
     * @return 日期字符串，格式为"yyyy-MM-dd"
     */
    public static Date getBeforeDate(int n) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DAY_OF_YEAR, -n);
        Date date = calendar.getTime();
        return date;
    }

    /*
     * @description: 获取最近的星期一
     * @author: sui q
     * @date: 2023/7/15 14:00
     * @param: null null
     **/
    public static String getRecentlyTuesday(String date){
        Date settleDate = parseStringToDate(date);
        DayOfWeek dayOfWeek = toLocalDate(settleDate).getDayOfWeek();
        if(dayOfWeek.getValue() == 1){
            return beforeDateStr(6, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, settleDate);
        }if(dayOfWeek.getValue() == 2){
            return parseDateToStr(DateUtils.YYYY_MM_DD, settleDate);
        }else{
            return beforeDateStr(dayOfWeek.getValue() -2, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, settleDate);
        }
    }

    /*
     * @description: 获取某一天的是这一周的第几天
     * @author: sui q
     * @date: 2023/7/15 14:00
     * @param: null null
     **/
    public static Integer getRecentlyDay(Date settleDate){
        DayOfWeek dayOfWeek = toLocalDate(settleDate).getDayOfWeek();
        return dayOfWeek.getValue();
    }

    /*
     * @description: 获取最近的星期二
     * @author: sui q
     * @date: 2023/7/15 14:00
     * @param: null null
     **/
    public static String getRecentlyTuesday(Date settleDate){
        DayOfWeek dayOfWeek = toLocalDate(settleDate).getDayOfWeek();
        if(dayOfWeek.getValue() == 1){
            return beforeDateStr(6, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, settleDate);
        }else if(dayOfWeek.getValue() == 2){
            return parseDateToStr(DateUtils.YYYY_MM_DD, settleDate);
        }else{
            return beforeDateStr(dayOfWeek.getValue() -2, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, settleDate);
        }
    }

    /*
     * @description: 获取最近的星期一
     * @author: sui q
     * @date: 2023/7/15 14:00
     * @param: null null
     **/
    public static String getRecentlyMonday(Date settleDate){
        DayOfWeek dayOfWeek = toLocalDate(settleDate).getDayOfWeek();
        if(dayOfWeek.getValue() == 1){
            return parseDateToStr(DateUtils.YYYY_MM_DD, settleDate);
        }else{
            return parseDateToStr(DateUtils.YYYY_MM_DD, afterDate(8- dayOfWeek.getValue(), ChronoUnit.DAYS, settleDate));
        }
    }

    /*
     * @description: 获取最近的星期一
     * @author: sui q
     * @date: 2023/7/15 14:00
     * @param: null null
     **/
    public static String getBeforeRecentlyMonday(Date settleDate){
        DayOfWeek dayOfWeek = toLocalDate(settleDate).getDayOfWeek();
        if(dayOfWeek.getValue() == 1){
            return parseDateToStr(DateUtils.YYYY_MM_DD, beforeDate(7, ChronoUnit.DAYS, settleDate));
        }else{
            return parseDateToStr(DateUtils.YYYY_MM_DD, beforeDate(dayOfWeek.getValue()-1, ChronoUnit.DAYS, settleDate));
        }
    }

    /**
     * 获取当前所在的季度
     *
     * @return int
     */
    public static int getQuarter() {
        LocalDate localDate = LocalDate.now();
        int month = localDate.getMonthValue();
        return (month - 1) / 3 + 1;
    }

    /**
     * 两个日期相差多少天
     *
     * @param endDate   结束时间
     * @param startDate 开始时间
     * @return
     */
    public static Long differenceDay(Date endDate, Date startDate) {
        long num = endDate.getTime() - startDate.getTime();
        return num / 24 / 60 / 60 / 1000;
    }

    /**
     * 获取当前日期，或者转换date
     *
     * @return Integer
     */
    public static Integer getCurrentHour() {
        LocalDateTime localDateTime = LocalDateTime.now();
        return localDateTime.getHour();
    }

    public static void main(String[] args) {
//        System.out.println(Base64Encoder.encode("139676"));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-09")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-10")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-11")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-12")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-13")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-14")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-15")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-16")));
        System.out.println(getBeforeRecentlyMonday(parseStringToDate("2023-10-17")));
//        System.out.println(DateUtils.getRecentlyMonday(DateUtils.parseStringToDate("2023-08-07")));
//        System.out.println(DateUtils.getRecentlyMonday(DateUtils.parseStringToDate("2023-08-08")));
//        System.out.println(DateUtils.getRecentlyMonday(DateUtils.parseStringToDate("2023-08-09")));
//        System.out.println(DateUtils.getRecentlyMonday(DateUtils.parseStringToDate("2023-08-10")));
//        System.out.println(getRecentlyMonday(DateUtils.parseStringToDate("2023-07-17")));
//        System.out.println(parseDateToSecond());
//        System.out.println(parseDateToSecond(currentDateTime()));
//        System.out.println(compareDate(currentDate(), afterDate(10, ChronoUnit.DAYS)));
//        System.out.println(compareDate(currentDate(), currentDate()));
//        System.out.println(parseDateToStr(DateUtils.YYYY_MM_DD, beforeDate(7, ChronoUnit.DAYS)));
//        System.out.println(compareDate(currentDate(), beforeDate(7, ChronoUnit.DAYS)));
//        System.out.println(betweenMonth(currentDate(), beforeDate(17, ChronoUnit.DAYS)));
//        System.out.println(beforeMonthFirstDateStr(12, currentDate()));
//        System.out.println(beforeMonthLastDate());
//        System.out.println(beforeMonthFirstDate());
//        System.out.println(currentMonthFirstDate());
//        System.out.println(currentMonthLastDate());
//        System.out.println(parseDateTimeToStr(DateUtils.YAMMERERS));
//        System.out.println(toLocalDate(currentDate()));
//        System.out.println(toLocalDateTime(currentDateTime()));
//        System.out.println(currentYear());
//        System.out.println(currentMonth());
//        System.out.println(currentDay());
//        System.out.println(getDateByCondition(2022, 8, 2));
//        System.out.println(compareDate(currentDate(), afterDate(10, ChronoUnit.DAYS)));
//        System.out.println(compareDateEqual(currentDate(), currentDate()));
//        System.out.println(compareDateAfter(currentDate(), afterDate(4, ChronoUnit.DAYS)));
//        System.out.println(compareDateBefore(currentDate(), beforeDate(4, ChronoUnit.MONTHS)));
//        System.out.println(isLeapYear());
//        System.out.println(checkBirthDate(getDateByCondition(1989, 10, 11)));
//        System.out.println(betweenDay(beforeDate(5, ChronoUnit.WEEKS)));
//        System.out.println(betweenMonth(beforeDate(10, ChronoUnit.WEEKS)));
//        System.out.println(parseStringToDate("2022-09-05"));
//        System.out.println(parseDateToStr(DateUtils.YAMMER, currentDate()));
//        System.out.println(parseDateToStr(DateUtils.YYYY_MM_DD, currentDate()));
//        System.out.println(parseDateToStr(DateUtils.YYYY, currentDate()));
//        System.out.println(parseDateToStr(DateUtils.YYYY_MM, currentDate()));
//        System.out.println(parseDateTimeToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, currentDateTime()));
    }


}
