You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In the current project I'm working on, we have logs which are submitted every day at different times, we don't care at all what time they are submitted, as long as they are submitted every day.
When using the diff method, it was returning a value which was unexpected.
final firstDateTime =DateTime(2022, 4, 1, 11, 20, 46);
final secondDateTime =DateTime(2022, 3, 30, 17, 56, 54);
final start =Jiffy(firstDateTime);
final end =Jiffy(secondDateTime);
final diff = start.diff(end, Units.DAY);
print('First: $first');
print('Second: $second');
print('Diff: $diff');
It'd be great if we could have another method which would give the option to ignore the time when considering the difference of two dates.
Describe alternatives you've considered
For now, I've created two new instances of DateTime ignoring the time fields from the real values and passed into Jiffy's constructor and this returns the expected value of 2 days difference.
final firstDateTime =DateTime(2022, 4, 1, 11, 20, 46);
final secondDateTime =DateTime(2022, 3, 30, 17, 56, 54);
final firstFormatted =DateTime(firstDateTime.year, firstDateTime.month, firstDateTime.day);
final secondFormatted =DateTime(secondDateTime.year, secondDateTime.month, secondDateTime.day);
final start =Jiffy(firstFormatted);
final end =Jiffy(secondFormatted);
final diff = start.diff(end, Units.DAY);
print('Diff: $diff');
Result
Diff: 2
Additional context
jiffy: 5.0.0
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
In the current project I'm working on, we have logs which are submitted every day at different times, we don't care at all what time they are submitted, as long as they are submitted every day.
When using the
diff
method, it was returning a value which was unexpected.Result
Describe the solution you'd like
It'd be great if we could have another method which would give the option to ignore the time when considering the difference of two dates.
Describe alternatives you've considered
For now, I've created two new instances of DateTime ignoring the time fields from the real values and passed into Jiffy's constructor and this returns the expected value of
2
days difference.Result
Additional context
jiffy: 5.0.0
The text was updated successfully, but these errors were encountered: