in_date_range

Last updated:

0 purchases

in_date_range Image
in_date_range Images
Add to Cart

Description:

in date range

in_date_range #



Encapsulates a start and end DateTime that represent the range of dates.
Usage #
Create DateRange that contains information about a range of dates:
final range = DateRange(
DateTime(2021, 6, 9, 18, 20),
DateTime(2021, 6, 10, 17, 00),
);
copied to clipboard
You can easily create common ranges, such as:
// Today
final today = DateRange.today();

// Day, that contains specefied DateTime
final week = DateRange.day(DateTime(2021, 6, 9));

// Week, that contains specefied DateTime
final week = DateRange.week(DateTime(2021, 6, 9));

// Specify first wekkday if you need it
final weekFromSunday = DateRange.week(
DateTime(2021, 6, 9),
firstWeekday: DateTime.sunday,
);

// Month, that contains specefied DateTime
final month = DateRange.month(DateTime(2021, 6, 9));

// Year, that contains specefied DateTime
final year = DateRange.year(DateTime(2021, 6, 9));
copied to clipboard
When you have DateRange instance, you can check if specified DateTime is in range:
final range = DateRange(
DateTime(2021, 6, 9, 18, 20),
DateTime(2021, 7, 20, 17, 00),
);
final date = DateTime(2021, 6, 11);

if (range.contains(date)) {
print('Range contains $date');
}
copied to clipboard
And there is more, see the API documentation.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.