app/helpers/datetime_helper.rb in drexed-datetime-0.0.9 vs app/helpers/datetime_helper.rb in drexed-datetime-0.0.10
- old
+ new
@@ -1,163 +1,209 @@
module DatetimeHelper
## Ex. 2013
def year_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%Y")
end
end
## Ex. December
def month_name_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%B")
end
end
## Ex. Dec
def abbr_month_name_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%b")
end
end
## Ex. 4
def day_number_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%e")
end
end
## Ex. Wednesday
def day_name_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%A")
end
end
## Ex. Wed
def abbr_day_name_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%a")
end
end
## Ex. 07:13 PM
def twelve_hour_time_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%I:%M %p")
end
end
## Ex. 07:13 PM EST
def twelve_hour_time_with_timezone_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%I:%M %p")
end
end
## Ex. 19:12
def twenty_four_hour_time_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%H:%M")
end
end
## Ex. 19:12 EST
def twenty_four_hour_time_with_timezone_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%H:%M %Z")
end
end
## Ex. December 4 at 07:11 PM
def month_day_and_time_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%B %e at %I:%M %p")
end
end
## Ex. Dec 4 at 07:11 PM
def abbr_month_day_and_time_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%b %e at %I:%M %p")
end
end
## Ex. December 4 at 07:11 PM EST
def month_day_and_time_with_timezone_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%B %e at %I:%M %p %Z")
end
end
## Ex. Dec 4 at 07:11 PM EST
def abbr_month_day_and_time_with_timezone_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%b %e at %I:%M %p %Z")
end
end
## Ex. December 4, 2013 at 07:11 PM
def datetime_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%B %e, %Y at %I:%M %p")
end
end
## Ex. Dec 4, 2013 at 07:11 PM
def abbr_datetime_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%b %e, %Y at %I:%M %p")
end
end
## Ex. December 4, 2013 at 07:11 PM EST
def datetime_with_timezone_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%B %e, %Y at %I:%M %p %Z")
end
end
## Ex. Dec 4, 2013 at 07:11 PM EST
def abbr_datetime_with_timezone_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%b %e, %Y at %I:%M %p %Z")
end
end
## Ex. December 4, 2013
def date_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%B %e, %Y")
end
end
## Ex. Dec 4, 2013
def abbr_date_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%b %e, %Y")
end
end
## Ex. December 4
def month_and_day_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%B %e")
end
end
## Ex. Dec 4
def abbr_month_and_day_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%b %e")
end
end
## Ex. EST
def timezone_name_for(tach)
- unless tach.blank?
+ if tach.blank?
+ "Datetime N/A"
+ else
tach.strftime("%Z")
end
end
end
\ No newline at end of file