endOf method

Jiffy endOf(
  1. Unit unit
)

Returns a new Jiffy instance representing the end of the specified unit of time

unit must be one of the values in Unit enumeration.

Example:

final jiffy = Jiffy.parse(
  '1997-09-23 13:37:00',
  pattern: 'yyyy-MM-dd HH:mm:ss'
);
final startOfDay = jiffy.endOf(Unit.DAY);
print(startOfDay.format('yyyy-MM-dd HH:mm:ss');
// output: '1997-09-23 23:59:59'

Implementation

Jiffy endOf(Unit unit) {
  final dateTime =
      _manipulator.endOf(this.dateTime, unit, _locale.startOfWeek());
  return _clone(dateTime);
}