Browse files

Adjusted date calculation concerning published_at.

  • Loading branch information...
1 parent fc13489 commit 01a45db9803441ab0cab50afdca1d0f55096da6a @jeremyf committed Jul 19, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/upload_news.rb
View
10 lib/upload_news.rb
@@ -21,11 +21,15 @@ def password
def parse_time(year, month, dayish)
begin
- if new_time = Time.local(year.to_i, month.to_i, dayish.to_i, 0, 0, dayish.to_i)
- return new_time
+ if new_time = Time.local(year.to_i, month.to_i, dayish.to_i, 2, 0, dayish.to_i)
+ if new_time.month != month.to_i
+ 2.hours.from_now(Time.local(year.to_i, month.to_i, 1).end_of_month.beginning_of_day + dayish.to_i)
+ else
+ return new_time
+ end
end
rescue ArgumentError => e
- return Time.local(year.to_i, month.to_i, 1).end_of_month.beginning_of_day + dayish.to_i
+ return 2.hours.from_now(Time.local(year.to_i, month.to_i, 1).end_of_month.beginning_of_day + dayish.to_i)
end
end

0 comments on commit 01a45db

Please sign in to comment.