Skip to content

Commit

Permalink
handle single digit dates
Browse files Browse the repository at this point in the history
  • Loading branch information
dotcode committed Mar 3, 2012
1 parent 2b36d07 commit 0839429
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion noms
Expand Up @@ -35,8 +35,11 @@ if now.strftime('%H') >= '09' and now.strftime('%H') < '14':
firstDateHeading = soup.find('div', 'heading-blue')
date = re.sub('^[^0-9]+', '', firstDateHeading.contents[0].string)
day = re.search('^[0-9]+', date)
# add leading zero to single digit dates
if len(day.group(0)) == 1:
day = '0' + day.group(0)
monthYear = re.search('[a-zA-Z]+ [0-9]+$', date)
firstDate = day.group(0) + ' ' + monthYear.group(0)
firstDate = day + ' ' + monthYear.group(0)

# see if that first date matches today's date
if now.strftime('%d %b %Y') == firstDate:
Expand Down

0 comments on commit 0839429

Please sign in to comment.