25 lines
465 B
Ruby
25 lines
465 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
# ERB view helper functions
|
||
|
module Helpers
|
||
|
|
||
|
def nullable(value)
|
||
|
# Returns the value if it actually exists
|
||
|
return value if value && (value != '')
|
||
|
|
||
|
# Returns a default 'N/a' string
|
||
|
return 'N/a'
|
||
|
end
|
||
|
|
||
|
def date_format(date)
|
||
|
dt = date.to_datetime
|
||
|
return dt.strftime('%B %d, %Y, %I:%M:%S %p')
|
||
|
end
|
||
|
|
||
|
def date_format_input(date)
|
||
|
dt = date.to_datetime
|
||
|
return dt.strftime('%Y-%m-%dT%H:%M:%S')
|
||
|
end
|
||
|
|
||
|
end
|