namespace OpenAuth.App.ServiceApp.ShpGeo.Utils;

public static class DateTimeExtensions
{
    public static int GetWeekOfYear(this DateTime time)
    {
        // 获取当前文化的日历
        System.Globalization.CultureInfo cultureInfo = System.Globalization.CultureInfo.CurrentCulture;
        // 使用 CalendarWeekRule.FirstFourDayWeek 规则计算周数
        return cultureInfo.Calendar.GetWeekOfYear(time, System.Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
    }
}