month_calculator 0.1.4 copy "month_calculator: ^0.1.4" to clipboard
month_calculator: ^0.1.4 copied to clipboard

Calculates the number of days and months in a givin dateTimeRange.

This will calculate the days and months in a givin date time range. It will also account for leap years.

So if we have a range like this

  DateTimeRange(start: DateTime(2023, 12, 20), end: DateTime(2024, 3, 21))

It will return 4 months and 0 days, but if we run the same thing with 2021 and 2022 we'll get 4 months and 1 day.

Usage #

final DateTimeRange rangeToMeasure = DateTimeRange(start: DateTime(2023, 12, 20), end: DateTime(2024, 3, 21));

final DayMonthCount count = MonthCalculator.monthsInRange(rangeToMeasure);

print("${count.months} months and ${count.days} days");

Additional information #

Feel free to make a PR if ya wanna add something cool or just improve efficiency.

1
likes
130
pub points
25%
popularity

Publisher

unverified uploader

Calculates the number of days and months in a givin dateTimeRange.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on month_calculator