#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 4; use DateTime; my $dt1 = DateTime->new ( year => 2015, month => 6, day => 1 ); my $dt2 = DateTime->new ( year => 2015, month => 6, day => 30 ); my $duration = $dt1->delta_days ($dt2); is $duration->days, 29, 'Without delta, more than a week'; is $duration->delta_days, 29, 'With delta, more than a week'; $dt2 = DateTime->new ( year => 2015, month => 6, day => 3 ); $duration = $dt1->delta_days ($dt2); is $duration->days, 2, 'Without delta, less than a week'; is $duration->delta_days, 2, 'With delta, less than a week';