0

I've got an app to manage rents. The lease periods are:

List<String> rentPeriods = [
    'daily',
    'weekly',
    'bimonthly',
    'monthly',
    '2_months',
    'quarterly',
    'biannual',
    'annual',
  ];

I need to display how many payments will the user have for that lease. For daily and weekly I do something like this:

final dailyPayments = to.difference(from).inDays;
final weeklyPayments = to.difference(from).inDays / 7;

But when I need to calculate months how could I do it? I can't just divide it by 30

Dani
  • 3,128
  • 2
  • 43
  • 91
  • This library considers months differences, maybe can fit you your need https://pub.dev/packages/jiffy – Jorge Vieira May 24 '21 at 15:54
  • [This post has the answer to your question using timemachine package](https://stackoverflow.com/questions/62170347/flutter-how-to-find-difference-between-two-dates-in-years-mo[nths-and-days]) – chamika madushanka May 24 '21 at 16:57
  • I was already using that package but how can I convert the different into months? – Dani May 24 '21 at 17:57

0 Answers0