Moment.fromDate constructor

Moment.fromDate(DateTime date)

Creates a new Moment with the specified date.

Throws a FormatException if the argument is null or of an invalid type.

Implementation

Moment.fromDate(DateTime date) {
  if (date != null && date is DateTime) {
    _date = date;
  } else {
    throw new FormatException('Date is null or of an invalid type.', date);
  }
}