Inspect DateTime object and convert back to YearMonth
factory YearMonth.dateTime(DateTime dateTime) => YearMonth(dateTime.year, dateTime.month);