Version 5 of Free-format clock scan

Updated 2007-02-15 16:04:55

See http://purl.org/tcl/home/man/tcl8.5/TclCmd/clock.htm

In 8.5, the old (up to 8.4) clock scan command is deprecated in favour of the new clock scan -format.

This is covered by TIP #173 [L1 ], and I understand the reasons behind creating the new version, but I think it would be a great pity to lose a great usability aid for applications that use dates - an easy way of letting the end user type in "yesterday" or "last week". I may be missing something, but I can't see any way to deal with this in the new version.

I guess what I am really saying is, deprecate it if you like, but don't ever take the old code out.


LV

 set EASTERN ":America/New_York"
 set s [clock scan now -timezone $EASTERN ]
 set yesterday [clock add $s -1 day -timezone $EASTERN]
 set x [clock format $yesterday -timezone $EASTERN]
 puts $x

Of course, you don't have to do things as seperate calls - you can do it as all one call.

 set nextweek [clock add $s 1 week -timezone $EASTERN]
 set x [clock format $nextweek -timezone $EASTERN]

The clock add should provide most, if not more, capability of the old freeform clock scan, with the downside of using a slightly different notation.


EMJ

I'm sure I could code anything I need, but I was actually talking about end-users, who would rather type in "yesterday" or "last week" or "13 jan" or "jan 13" than select from a popup calendar - at the moment I just pass their input to clock scan, what would I have to do if it wasn't there?


[ Category Date and Time ]