from static method

DateComponents from(
  1. DateTime date
)

Convenience method that returns a DateComponents from a given DateTime

date the date return the DateComponents (according to the default device timezone)

Implementation

static DateComponents from(DateTime date) {
  return DateComponents(date.year, date.month, date.day);
}