comparison roundup/date.py @ 234:0dfe39b4fa17

fixed prettification of intervals of 1 week
author Richard Jones <richard@users.sourceforge.net>
date Fri, 17 Aug 2001 03:08:11 +0000
parents 1d1848c99abe
children 96cdd8ef0581
comparison
equal deleted inserted replaced
233:3430c76a52b0 234:0dfe39b4fa17
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.11 2001-08-15 23:43:18 richard Exp $ 18 # $Id: date.py,v 1.12 2001-08-17 03:08:11 richard Exp $
19 19
20 import time, re, calendar 20 import time, re, calendar
21 21
22 class Date: 22 class Date:
23 ''' 23 '''
322 if days > 28: 322 if days > 28:
323 return '%s months'%int(days/30) 323 return '%s months'%int(days/30)
324 else: 324 else:
325 return '%s weeks'%int(days/7) 325 return '%s weeks'%int(days/7)
326 if self.day > 7: 326 if self.day > 7:
327 return '%s weeks'%self.day 327 return '1 week'
328 if self.day > 1: 328 if self.day > 1:
329 return '%s days'%self.day 329 return '%s days'%self.day
330 if self.day == 1 or self.hour > 12: 330 if self.day == 1 or self.hour > 12:
331 return 'yesterday' 331 return 'yesterday'
332 if self.hour > 1: 332 if self.hour > 1:
374 if __name__ == '__main__': 374 if __name__ == '__main__':
375 test() 375 test()
376 376
377 # 377 #
378 # $Log: not supported by cvs2svn $ 378 # $Log: not supported by cvs2svn $
379 # Revision 1.11 2001/08/15 23:43:18 richard
380 # Fixed some isFooTypes that I missed.
381 # Refactored some code in the CGI code.
382 #
379 # Revision 1.10 2001/08/07 00:24:42 richard 383 # Revision 1.10 2001/08/07 00:24:42 richard
380 # stupid typo 384 # stupid typo
381 # 385 #
382 # Revision 1.9 2001/08/07 00:15:51 richard 386 # Revision 1.9 2001/08/07 00:15:51 richard
383 # Added the copyright/license notice to (nearly) all files at request of 387 # Added the copyright/license notice to (nearly) all files at request of

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