示例#1
0
        public static CalendarDate Build(DateTime solarDate)
        {
            var dest = new CalendarDate()
            {
                SolarDate = solarDate,
                SolarDay  = solarDate.Day
            };
            Solar solar = new Solar(solarDate);
            Lunar lunar = solar.getLunar();
            var   jieQi = lunar.getCurrentJieQi();

            if (jieQi != null)
            {
                dest.SolarTerm = jieQi.getName();
            }
            dest.LunarDay   = lunar.getDayInChinese();
            dest.LunarMonth = lunar.getMonthInChinese();
            var holidayList = HolidayUtil.getHolidaysByTarget(solarDate.Year, solarDate.Month, solarDate.Day);

            if (holidayList != null && holidayList.Count > 0)
            {
                var holidayStr = string.Join(" ", holidayList.Select(m => m.getName()));
                dest.Holiday = holidayStr;
            }


            return(dest);
        }