clock scan returns wrong date if dayOfMonth is missing
Openb32fffae8156a93d7c083122fdb7e22a10ecf4aaCreated 12 years agoUpdated 12 years ago
Descriptionplain2015-05-05 09:25:52
Hello, when using 'clock scan' to get the date of a string containing "month" and "yearOfCentury" today's date is returned instead of assuming "1" for the "dayOfMonth" and returning the given date. I think this can be fixed in the DateParseActions table in clock.tcl. The following two examples show the problem: set d1 [clock scan "Apr12" -format "%b%y"] puts [clock format $d1 -format "%d %B %Y"] #--> result in today's date set d2 [clock scan "17Apr12" -format "%d%b%y"] puts [clock format $d2 -format "%d %B %Y"] #--> 17 April 2012
sebresplain2015-05-05 09:48:27
This is undefined behaviour, because scanning of date not completed (not all required date fields fulfilled). Explanation is simple: puts [clock scan "Apr12" -format "%b%y" -base 0 -gmt 1]; # will returns 0 Simple solution does not exists, because I'm sure that 01 as default day would be incorrect. Just use formats always have a days.
dkf Ticket [b32fffae81]: 4 changes
[History diff]2015-05-16 05:53:28
Log in (anonymous is fine) to add a comment.