#
# ajd2.txt - ajoffsetdate tests
# ========
# This script tests the ability to offset a date by seconds,
# minutes, hours and days.
#

#
# Set and verify the current date and time
#
ajsetdate 2011-07-15,15:00:00
ajformatdate PLAIN

#
# Check second offset
#
ajoffsetdate 5 SEC       # -> 2011-07-15,15:00:05
ajformatdate PLAIN       #
ajoffsetdate -6 SEC      # -> 2011-07-15,14:59:59
ajformatdate PLAIN       #
ajoffsetdate 1 SEC       # -> 2011-07-15,15:00:00
ajformatdate PLAIN       #

#
# Check minute offset
#
ajoffsetdate 5 MIN       # -> 2011-07-15,15:05:00
ajformatdate PLAIN       #
ajoffsetdate -6 MIN      # -> 2011-07-15,14:59:00
ajformatdate PLAIN       #
ajoffsetdate 1 MIN       # -> 2011-07-15,15:00:00
ajformatdate PLAIN       #

#
# Check hour offset
#
ajoffsetdate 5 HOUR      # -> 2011-07-15,20:00:00
ajformatdate PLAIN       #
ajoffsetdate -6 HOUR     # -> 2011-07-15,14:00:00
ajformatdate PLAIN       #
ajoffsetdate 1 HOUR      # -> 2011-07-15,15:00:00
ajformatdate PLAIN       #

#
# Check day offset
#
ajoffsetdate 5 DAY       # -> 2011-07-20,15:00:00
ajformatdate PLAIN       #
ajoffsetdate -6 DAY      # -> 2011-07-14,15:00:00
ajformatdate PLAIN       #
ajoffsetdate 1 DAY       # -> 2011-07-15,15:00:00
ajformatdate PLAIN       #

#
# Check a fancy mixed offset
#
ajoffsetdate 300 SEC     # -> 2011-07-15,15:05:00
ajformatdate PLAIN       #
ajoffsetdate 120 MIN     # -> 2011-07-15,17:05:00
ajformatdate PLAIN       #
ajoffsetdate 48 HOUR     # -> 2011-07-17,17:05:00
ajformatdate PLAIN       #
ajoffsetdate -180300 SEC # -> 2011-07-15 15:00:00
ajformatdate PLAIN       #

#
# Check a null op.
#
ajoffsetdate 0 DAY
ajformatdate PLAIN       # 2011-07-15 15:00:00 expected

#
# Check that an incorrect element code is trapped 
#
ajformatdate PLAIN       # Show start date: 2011-07-15 15:00:00
ajoffsetdate 5 INCORRECT # Should throw an error
ajformatdate PLAIN       # Date should stay the same
ajoffsetdate 15 20       # Should throw an error
ajformatdate PLAIN       # Date should stay the same

#
# 2 errors expected
#
