implement more LogSource features (logs for date, cleanup last_logs), implement irssi parser, formatter, other misc. stuff
"""
Miscellaneous things
"""
import datetime
class Date (object) :
"""
Handle dates in URLs as datetime objects (with indeterminate time info) in some timezone
"""
def __init__ (self, tz, date_fmt="%Y-%m-%d") :
"""
Format/parse dates in the given timezone using the given format
"""
self.tz = tz
self.date_fmt = date_fmt
__name__ = "date"
def __call__ (self, date_str) :
"""
Parse the given date string
"""
return datetime.datetime.strptime(date_str, self.date_fmt).replace(tzinfo=self.tz)