Module: Jekyll::PastDeadlineFilter

Defined in:
jekyll/_plugins/past-deadline.rb

Instance Method Summary collapse

Instance Method Details

#pastDeadlineAfterMonths(input_key, interval_months) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'jekyll/_plugins/past-deadline.rb', line 14

def pastDeadlineAfterMonths(input_key, interval_months)
	unless input_key.nil?
	    
		start_time = if input_key
              
                  begin
                      Date.strptime(input_key, "%m/%d/%Y").to_time.to_i 
                  rescue 
                      Jekyll.logger.warn "PastDeadlineFilter Bad Date #{input_key}"
                      return false
                  end
		
              end
              
              # average month = 2629800 seconds = 365.25 days / 12
		interval = interval_months.to_f * 2629800
		
		if (DateTime.now.to_time.to_i > start_time + interval)
		    true
		else
		    false
		end
		
	end
end