Index: openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 27 Oct 2014 16:39:32 -0000 1.13 +++ openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 7 Aug 2017 23:47:55 -0000 1.14 @@ -74,9 +74,9 @@ } { set date_list [dt_ansi_to_list $ansi] - set year [dt_trim_leading_zeros [lindex $date_list 0]] - set month [dt_trim_leading_zeros [lindex $date_list 1]] - set day [dt_trim_leading_zeros [lindex $date_list 2]] + set year [util::trim_leading_zeros [lindex $date_list 0]] + set month [util::trim_leading_zeros [lindex $date_list 1]] + set day [util::trim_leading_zeros [lindex $date_list 2]] return [dt_ansi_to_julian $year $month $day $era] } @@ -103,6 +103,8 @@ # 1582-10-04; 1582-10-15) set julian_date [dt_ansi_to_julian 1582 10 15 CE] } else { + set year [util::trim_leading_zeros $year] + if {$era eq "BCE"} { set year [expr {-$year + 1}] } @@ -159,19 +161,11 @@ } set day [expr {floor($calc - $calc3 - floor($calc4 * 30.6001))}] - set year [expr {int($year)}] + set year [expr {int($year)}] set month [expr {int($month)}] - set day [expr {int($day)}] + set day [expr {int($day)}] - if {$month < 10} { - set month 0$month - } - - if {$day < 10} { - set day 0$day - } - - return $year-$month-$day + return [format %.4d $year]-[format %.2d $month]-[format %.2d $day] } ad_proc -public dt_ansi_to_pretty { @@ -200,7 +194,7 @@ } foreach item [split [clock format [clock scan $ansi_date] -format "%Y %m %d %H %M %S"] " "] { - lappend date_info [dt_trim_leading_zeros $item] + lappend date_info [util::trim_leading_zeros $item] } return $date_info @@ -488,7 +482,7 @@ } if {$default ne ""} { - set default [dt_trim_leading_zeros $default] + set default [util::trim_leading_zeros $default] } set input "