You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2005/01/25 18:31:33 UTC
DO NOT REPLY [Bug 33240] New: -
propertyfile date operation results in invalid date
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33240>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33240
Summary: propertyfile date operation results in invalid date
Product: Ant
Version: 1.6.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Optional Tasks
AssignedTo: dev@ant.apache.org
ReportedBy: pbunce@momentumsi.com
Using propertyfile for date operation yields invalid dates.
I am using a temporary (created and deleted each time) properties file for
verifying default dates in testing (e.g. departure date should default to one
week from today), however the properties resulting from date operation (+)
gives invalid dates. Today is 01/25/2005 (), so one week from now should be
02/01/2005, but the entry ends up as 02/32/2005. The month gets incremented due
to the wrap-over into Feb, but the day is just 25 + 7, instead of mod(#days-in-
orig-month). Just in case, I tried adding 1 week and adding 7 days, same result
(as expected).
===========================================
Sample build file:
===========================================
<project name="dateTest" default="main" basedir=".">
<property name="test.props" value="tmp.properties"/>
<propertyfile
file="${test.props}"
comment="My properties">
<entry key="default.now"
type="date" default="now" pattern="MM/DD/yyyy" />
<entry key="default.departure.date.week"
type="date" default="now" pattern="MM/DD/yyyy"
operation="+" value="1" unit="week"/>
<entry key="default.departure.date.day"
type="date" default="now" pattern="MM/DD/yyyy"
operation="+" value="7" unit="day"/>
</propertyfile>
<target name="main" depends="echoTestProps,cleanTestProps"/>
<target name="echoTestProps" description="echo the test.properties
files">
<property file="${test.props}"/>
<echo message="default.now=${default.now}"/>
<echo
message="default.departure.date.week=${default.departure.date.week}"/>
<echo
message="default.departure.date.day=${default.departure.date.day}"/>
</target>
<target name="cleanTestProps" description="cleans the test.properties
files">
<delete file="${test.props}"/>
</target>
</project>
===========================================
Sample output:
===========================================
Buildfile: C:\Projects\SkyLink\dateTest.xml
[propertyfile] Creating new property file: C:\Projects\SkyLink\tmp.properties
echoTestProps:
[echo] default.now=01/25/2005
[echo] default.departure.date.week=02/32/2005
[echo] default.departure.date.day=02/32/2005
cleanTestProps:
[delete] Deleting: C:\Projects\SkyLink\tmp.properties
main:
BUILD SUCCESSFUL
Total time: 281 milliseconds
===========================================
Regards,
-Phil
pbunce@momentumsi.com
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org