Tk Library Source Code

View Ticket
Login
Ticket UUID: 1445692
Title: parsedatetime month wrong
Type: Bug Version: None
Submitter: usus Created on: 2006-03-08 14:45:19
Subsystem: mime Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-03-08 22:59:10
Resolution: Out of Date Closed By: andreas_kupries
    Closed on: 2006-03-08 15:59:10
Description:
mime::parsedatetime -now proper determines the wrong
month. Same is with lmonth and month.

Here's a diff to a correctly working mime.tcl:

diff -c /usr/local/lib/tcllib1.8/mime/mime.tcl.orig
/usr/local/lib/tcllib1.8/mime/mime.tcl
*** /usr/local/lib/tcllib1.8/mime/mime.tcl.orig     
2005-10-04 20:47:37.000000000 +0200
--- /usr/local/lib/tcllib1.8/mime/mime.tcl 2006-03-08
16:29:33.000000000 +0200
***************
*** 3256,3264 ****
          variable WDAYS_LONG   [list Sunday Monday
Tuesday Wednesday Thursday \                          
           Friday Saturday]

!         variable MONTHS_SHORT [list Jan Feb Mar Apr
May Jun \
                                      Jul Aug Sep Oct
Nov Dec]
!         variable MONTHS_LONG  [list January February
March April May June July \
                                      August Sepember
October November December]  }
  proc ::mime::parsedatetime {value property} {
--- 3256,3264 ----
          variable WDAYS_LONG   [list Sunday Monday
Tuesday Wednesday Thursday \                          
           Friday Saturday]

!         variable MONTHS_SHORT [list "" Jan Feb Mar
Apr May Jun \
                                      Jul Aug Sep Oct
Nov Dec]
!         variable MONTHS_LONG  [list "" January
February March April May June July \
                                      August Sepember
October November December]  }
  proc ::mime::parsedatetime {value property} {
***************
*** 3275,3281 ****

          lmonth {
              variable MONTHS_LONG
!             return [lindex $MONTHS_LONG [clock format
$clock -format %e]]
          }

          lweekday {
--- 3275,3281 ----

          lmonth {
              variable MONTHS_LONG
!             return [lindex $MONTHS_LONG [string
trimleft [clock format $clock -format %m] 0]]
          }

          lweekday {
***************
*** 3297,3303 ****

          month {
              variable MONTHS_SHORT
!             return [lindex $MONTHS_SHORT [clock
format $clock -format %e]]
          }

          proper {
--- 3297,3303 ----

          month {
              variable MONTHS_SHORT
!             return [lindex $MONTHS_SHORT [string
trimleft [clock format $clock -format %m] 0]]
          }

          proper {
***************
*** 3314,3320 ****
              variable WDAYS_SHORT
              set wday [lindex $WDAYS_SHORT [clock
format $clock -format %w]]
              variable MONTHS_SHORT
!             set mon [lindex $MONTHS_SHORT [clock
format $clock -format %e]]

              return [clock format $clock \
                            -format "$wday, %d $mon %Y
%H:%M:%S $zone"]
--- 3314,3320 ----
              variable WDAYS_SHORT
              set wday [lindex $WDAYS_SHORT [clock
format $clock -format %w]]
              variable MONTHS_SHORT
!             set mon [lindex $MONTHS_SHORT [string
trimleft [clock format $clock -format %m] 0]]

              return [clock format $clock \
                            -format "$wday, %d $mon %Y
%H:%M:%S $zone"]
User Comments: andreas_kupries added on 2006-03-08 22:59:09:
Logged In: YES 
user_id=75003

I wish I could set multiple resolution. This is out of date,
and fixed in the CVS head. See also the items 

https://sourceforge.net/tracker/index.php?func=detail&aid=1403452&group_id=12883&atid=112883
https://sourceforge.net/tracker/index.php?func=detail&aid=1425947&group_id=12883&atid=112883

Changelog:

This is already fixed in the CVS Head.

2005-11-03  Andreas Kupries 
<[email protected]>

* mime.tcl: Applied patch by Benjamin Riefenstahl fixing
bugs in his patch for [SF Tcllib Bug 1276561], see
2005-10-04 entry.
  * (MONTHS_SHORT, MONTHS_LONG): Add a dummy entry at index 0.

  * (parsedatetime): For month index, use "%m" + scan
instead of wrong "%e".