#!/usr/bin/perl
#
#NAME
#  DateTest - Test Date::Manip module.
#
#SYNOPSIS
#  DateTest
#
#DESCRIPTION
#  This feeds a number of symbolic dates to the  Date::Manip  module,
#  and  then  converts  them  back to a couple of standard forms, and
#  outputs the results.  This is your basic regression test, using  a
#  number of dates that have caused problems in the past.
#
#AUTHOR
# John Chambers <jc@trillian.mit.edu>

use Date::Manip;
$S = time;
$D = &ParseDateString("epoch $S");
$P = &UnixDate($D,'%C');
print "Date \"$D\" p=\"$P\" s=\"$S\" $t\n";
@d = (
	'19980102030405',
	'19980102030405Z',
	'19980102030405 UT',
	'19980102030405 EST',
	'19980102030405+0600',
	'1998-01-02 03:04:05',
	'1998-01-02 03:04:05 UT',
	'1998-01-02 03:04:05 EST',
	'1998/01/02 03:04:05',
	'1998/01/0203:04:05',
	'1998/1/02 03:04:05',
	'1998/01/2 03:04:05',
	'1998/01/02 3:04:05',
	'1998/01/02 03:4:05',
	'1998/01/02 03:04:5',
	'20000102030405',
	'20200102030405',
	'tomorrow',
	'tomorrow + 1:10',
);
for $d (@d) {
	$p = &ParseDate($d);
	$s = &UnixDate($d,"%s");
	$t = &UnixDate($d,"%C");
	print "Date \"$d\" p=\"$p\" s=\"$s\" $t\n";
}
