dateFormat property

DateFormat? dateFormat

Formats the date labels. It is mandatory for date SfRangeSlider.

For date values, the range slider doesn’t have auto interval support. So, you may need to set interval, dateIntervalType, and dateFormat for date values, if labels, ticks, and dividers are needed.

Defaults to null.

This snippet shows how to set date format in SfRangeSlider.

SfRangeValues _values = SfRangeValues(
        DateTime(2002, 01, 01), DateTime(2003, 01, 01));

  min: DateTime(2000, 01, 01, 00),
  max: DateTime(2005, 12, 31, 24),
  values: _values,
  interval: 1,
  showLabels: true,
  showTicks: true,
  dateFormat: DateFormat.y(),
  dateIntervalType: DateIntervalType.years,
  onChanged: (SfRangeValues newValues) {
    setState(() {
      _values = newValues;

See also:


final DateFormat? dateFormat;