I think this problem is likely to be as a result of server/eggdrop language settings rather than timezone, since a timezone will often encompass several countries/languages.
The best solution would be to think about a rewrite of the script to deal with day and month numbers, mapping the numbers to names or names to numbers wherever required. I'll give it some thought but it would obviously be a pretty major rewrite.
set vFinddateVersion 11.03.08.14.01
bind PUB - !finddate pPubFinddate
proc pPubFinddate {nick uhost hand chan text} {
set vars [split $text]
if {[llength $vars] == 4} {
set day [lindex $vars 0]; set month [lindex $vars 1]; set year [lindex $vars 2]; set number [lindex $vars 3]
switch -- [set date [pParseFinddate $day $month $year $number]] {
e1 {putserv "PRIVMSG $chan :invalid or misspelt full day name"}
e2 {putserv "PRIVMSG $chan :invalid or misspelt full month name"}
e3 {putserv "PRIVMSG $chan :year value was not an integer"}
e4 {putserv "PRIVMSG $chan :year value was not the 4 digits expected"}
e5 {putserv "PRIVMSG $chan :year value was outside the range 1971 through 2037"}
e6 {putserv "PRIVMSG $chan :number value was not an integer"}
e7 {putserv "PRIVMSG $chan :number value was outside the range 1 through 5"}
e8 {putserv "PRIVMSG $chan :cannot find $number [string totitle ${day}'s] in [string totitle $month] $year"}
default {putserv "PRIVMSG $chan :$date"}
}
} else {putserv "PRIVMSG $chan :correct syntax is !finddate <day> <month> <year> <number>"}
return 0
}
proc pParseFinddate {day month year number} {
set dayname [string tolower $day]
set monthname [string tolower $month]
if {[lsearch -exact {sunday monday tuesday wednesday thursday friday saturday} $dayname] == -1} {return e1}
if {[lsearch -exact {january february march april may june july august september october november december} $monthname] == -1} {return e2}
if {![string is integer -strict $year]} {return e3}
if {[string length $year] != 4} {return e4}
if {($year < 1971) || ($year > 2037)} {return e5}
if {![string is integer -strict $number]} {return e6}
if {($number < 1) || ($number > 5)} {return e7}
set daynumber [pMappingFinddate $dayname 1]
set monthnumber [pMappingFinddate $monthname 2]
set target 1
for {set loop 1} {$loop <= 32} {incr loop} {
set date "$year-$monthnumber-[format %02i $loop]"
if {[catch {set datevalue [clock scan $date]}]} {return e8}
if {![string equal [clock format $datevalue -format %m] $monthnumber]} {return e8}
if {[string equal [clock format $datevalue -format %u] $daynumber]} {
if {[string equal $target $number]} {
set rday [pMappingFinddate [clock format $datevalue -format %u] 3]
set rdate [clock format $datevalue -format %d]
set rmonth [pMappingFinddate [clock format $datevalue -format %m] 4]
set ryear [clock format $datevalue -format %Y]
return "$rday $rdate $rmonth $ryear"
} else {incr target}
}
}
return 0
}
proc pMappingFinddate {input type} {
switch -- $type {
1 {set output [string map -nocase {monday 1 tuesday 2 wednesday 3 thursday 4 friday 5 saturday 6 sunday 7} $input]}
2 {set output [string map -nocase {january 01 february 02 march 03 april 04 may 05 june 06 july 07 august 08 september 09 october 10 november 11 december 12} $input]}
3 {set output [string map {1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday 7 Sunday} $input]}
4 {set output [string map {01 January 02 February 03 March 04 April 05 May 06 June 07 July 08 August 09 September 10 October 11 November 12 December} $input]}
default {}
}
return $output
}
putlog "finddate.tcl version $vFinddateVersion loaded"
# eof