Today Mod
2.2
This a completely rewritten version of the buggy "Today" mod. Now everywhere on the board the date will be replaced by the word "today" if the date is equal to the current date. This works with any time format. This mod has been optimsed to be small and touch as few files as possible. It is compatible with any other mod (except the old today mod - you have to uninstall it first)
v2.1: thiny fix for dateformat setting no 3
v2.2: now it works properly with different usertimeoffsets
[CV]XXL
http://boardmod.xnull.com
Sources\Subs.pl
if ($mytimeselected == 1) {
$newformat = qq~$newmonth/$newday/$newshortyear $txt{'107'} $newtime~;
return $newformat;
} elsif ($mytimeselected == 2) {
$newformat = qq~$newday.$newmonth.$newshortyear $txt{'107'} $newtime~;
return $newformat;
} elsif ($mytimeselected == 3) {
$newformat = qq~$newday.$newmonth.$newyear $txt{'107'} $newtime~;
return $newformat;
} elsif ($mytimeselected == 4) {
$newmonth--;
$ampm = $newhour > 11 ? 'pm' : 'am';
$newhour2 = $newhour % 12 || 12;
$newmonth2 = $months[$newmonth];
if( $newday > 10 && $newday < 20 ) { $newday2 = 'th'; }
elsif( $newday % 10 == 1 ) { $newday2 = 'st'; }
elsif( $newday % 10 == 2 ) { $newday2 = 'nd'; }
elsif( $newday % 10 == 3 ) { $newday2 = 'rd'; }
else{ $newday2 = 'th'; }
$newformat = qq~$newmonth2 $newday$newday2, $newyear, $newhour2:$newminute$ampm~;
return $newformat;
} elsif ($mytimeselected == 5) {
$ampm = $newhour > 11 ? 'pm' : 'am';
$newhour2 = $newhour % 12 || 12;
$newformat = qq~$newmonth/$newday/$newshortyear $txt{'107'} $newhour2:$newminute$ampm~;
return $newformat;
} elsif ($mytimeselected == 6) {
$newmonth2 = $months[$newmonth-1];
$newformat = qq~$newday. $newmonth2 $newyear $txt{'107'} $newhour:$newminute~;
return $newformat;
}
$usertimeoffset = $timeoffset + $settings[18];
($secx,$minx,$hourx,$dd,$mm,$yy,$tmpx,$tmpx,$tmpx) = localtime(time + (3600*$usertimeoffset));
$mm = $mm + 1;
$yy = ($yy % 100);
$dontusetoday = $_[1] + 0;
if ($mytimeselected == 1) {
$newformat = qq~$newmonth/$newday/$newshortyear $txt{'107'} $newtime~;
if ($mm == $newmonth && $dd == $newday && $yy == $newshortyear && $dontusetoday == 0) { $newformat = qq~Today $txt{'107'} $newtime~; }
return $newformat;
} elsif ($mytimeselected == 2) {
$newformat = qq~$newday.$newmonth.$newshortyear $txt{'107'} $newtime~;
if ($mm == $newmonth && $dd == $newday && $yy == $newshortyear && $dontusetoday == 0) { $newformat = qq~Today $txt{'107'} $newtime~; }
return $newformat;
} elsif ($mytimeselected == 3) {
$newformat = qq~$newday.$newmonth.$newyear $txt{'107'} $newtime~;
if ($mm == $newmonth && $dd == $newday && $yy == $newshortyear && $dontusetoday == 0) { $newformat = qq~Today $txt{'107'} $newtime~; }
return $newformat;
} elsif ($mytimeselected == 4) {
$newmonth--;
$ampm = $newhour > 11 ? 'pm' : 'am';
$newhour2 = $newhour % 12 || 12;
$newmonth2 = $months[$newmonth];
if( $newday > 10 && $newday < 20 ) { $newday2 = 'th'; }
elsif( $newday % 10 == 1 ) { $newday2 = 'st'; }
elsif( $newday % 10 == 2 ) { $newday2 = 'nd'; }
elsif( $newday % 10 == 3 ) { $newday2 = 'rd'; }
else{ $newday2 = 'th'; }
$newformat = qq~$newmonth2 $newday$newday2, $newyear, $newhour2:$newminute$ampm~;
if ($mm == $newmonth + 1 && $dd == $newday && $yy == $newshortyear && $dontusetoday == 0) { $newformat = qq~Today $txt{'107'} $newhour2:$newminute$ampm~; }
return $newformat;
} elsif ($mytimeselected == 5) {
$ampm = $newhour > 11 ? 'pm' : 'am';
$newhour2 = $newhour % 12 || 12;
$newformat = qq~$newmonth/$newday/$newshortyear $txt{'107'} $newhour2:$newminute$ampm~;
if ($mm == $newmonth && $dd == $newday && $yy == $newshortyear && $dontusetoday == 0) { $newformat = qq~Today $txt{'107'} $newhour2:$newminute$ampm~; }
return $newformat;
} elsif ($mytimeselected == 6) {
$newmonth2 = $months[$newmonth-1];
$newformat = qq~$newday. $newmonth2 $newyear $txt{'107'} $newhour:$newminute~;
if ($mm == $newmonth && $dd == $newday && $yy == $newshortyear && $dontusetoday == 0) { $newformat = qq~Today $txt{'107'} $newhour:$newminute~; }
return $newformat;
}
$yytime = &timeformat($date);
$yytime = &timeformat($date, 1);
English.lng
1;
$today{'1'} = qq~Today at~;