New Message: Less Than 10 Days Ago

webmaster at userland.com webmaster at userland.com
Tue Jul 12 09:37:41 CDT 2005


A new message was posted:

Address: http://manila.userland.com/discuss/msgReader$1110

By: Matt Deatherage (frontier at gcsf.com)

Your snippet is much more complicated than mine, Steve. :-) To make it look like I did more real work, I've generalized it to any number of days:

on lessThanXDaysAgo (oldDate, numOfDays) {
 local (msgDate, mday, mmonth, myear, mhour, mminute, msecond);
 date.get(oldDate, @mday, @mmonth, @myear, @mhour, @mminute, @msecond);
 msgDate = date.set(mday+numOfDays, mmonth, myear, mhour, mminute, msecond);
 return (msgDate clock.now())}

This works even if oldDate is in the future, but will probably fail if numOfDays is larger than the number of days between the message's last update and Feb 6, 2040. So for a message posted today, numOfDays should really be 12,626 or less.

I should pick up "numOfDays" from a #newsSite entry so each site could configure its own allowable trackback window. Maybe next weekend.

This is a Manila site.. http://manila.userland.com/.




More information about the Manila-Users mailing list