time duration flutter code example
Example 1: calculate time difference with now in flutter
var jiffy1 = Jiffy()
..add(duration: Duration(days: 1));
jiffy1.yMMMMd;
var jiffy2 = Jiffy()
..subtract(days: 1);
jiffy2.yMMMMd;
var jiffy3 = Jiffy()
..add(hours: 3, days: 1)
..subtract(minutes: 30, months: 1);
jiffy3.yMMMMEEEEdjm;
var jiffy4 = Jiffy()
..add(duration: Duration(days: 1, hours: 3))
..subtract(duration: Duration(minutes: 30));
jiffy4.format("dd/MM/yyy");
Jiffy("2010/1/31", "yyyy-MM-dd");
Jiffy([2010, 1, 31]).add(months: 1);
Example 2: calculate time difference with now in flutter
Jiffy("2011-10-31", "yyyy-MM-dd").fromNow();
Jiffy("2012-06-20").fromNow();
var jiffy1 = Jiffy()
..startOf(Units.DAY);
jiffy1.fromNow();
var jiffy2 = Jiffy()
..endOf(Units.DAY);
jiffy2.fromNow();
var jiffy3 = Jiffy()
..startOf(Units.HOUR);
jiffy3.fromNow();