fromDateTime method

DateModel fromDateTime(
  1. DateTime dateTime
)

Implementation

static DateModel fromDateTime(DateTime dateTime) {
  DateModel dateModel = new DateModel()
    ..year = dateTime.year
    ..month = dateTime.month
    ..day = dateTime.day;
  List<int> lunar =
      LunarUtil.solarToLunar(dateModel.year, dateModel.month, dateModel.day);
  dateModel.lunar = lunar;

//    将数据的初始化放到各个get方法里面进行操作,类似懒加载,不然很浪费
//    LunarUtil.setupLunarCalendar(dateModel);
  return dateModel;
}