comparison roundup/date.py @ 720:5e0a75bfdd90

reverting to dates for intervals > 2 months sucks
author Richard Jones <richard@users.sourceforge.net>
date Wed, 15 May 2002 06:32:46 +0000
parents cfa460943d4d
children 68cef2bb929d
comparison
equal deleted inserted replaced
719:fed4c363a7f3 720:5e0a75bfdd90
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: date.py,v 1.20 2002-02-21 23:34:51 richard Exp $ 18 # $Id: date.py,v 1.21 2002-05-15 06:32:46 richard Exp $
19 19
20 __doc__ = """ 20 __doc__ = """
21 Date, time and time interval handling. 21 Date, time and time interval handling.
22 """ 22 """
23 23
364 return '<Interval %s>'%self.__str__() 364 return '<Interval %s>'%self.__str__()
365 365
366 def pretty(self): 366 def pretty(self):
367 ''' print up the date date using one of these nice formats.. 367 ''' print up the date date using one of these nice formats..
368 ''' 368 '''
369 if self.year or self.month > 2: 369 if self.year:
370 return None 370 if self.year == 1:
371 return _('1 year')
372 else:
373 return _('%(number)s years')%{'number': self.year}
371 elif self.month or self.day > 13: 374 elif self.month or self.day > 13:
372 days = (self.month * 30) + self.day 375 days = (self.month * 30) + self.day
373 if days > 28: 376 if days > 28:
374 if int(days/30) > 1: 377 if int(days/30) > 1:
375 s = _('%(number)s months')%{'number': int(days/30)} 378 s = _('%(number)s months')%{'number': int(days/30)}
435 if __name__ == '__main__': 438 if __name__ == '__main__':
436 test() 439 test()
437 440
438 # 441 #
439 # $Log: not supported by cvs2svn $ 442 # $Log: not supported by cvs2svn $
443 # Revision 1.20 2002/02/21 23:34:51 richard
444 # Oops, there's 24 hours in a day, and subtraction of intervals now works
445 # properly.
446 #
440 # Revision 1.19 2002/02/21 23:11:45 richard 447 # Revision 1.19 2002/02/21 23:11:45 richard
441 # . fixed some problems in date calculations (calendar.py doesn't handle over- 448 # . fixed some problems in date calculations (calendar.py doesn't handle over-
442 # and under-flow). Also, hour/minute/second intervals may now be more than 449 # and under-flow). Also, hour/minute/second intervals may now be more than
443 # 99 each. 450 # 99 each.
444 # 451 #

Roundup Issue Tracker: http://roundup-tracker.org/