Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/ndr_support/date_and_time_extensions.rb

Instance Method Summary collapse

Instance Method Details

#orig_to_datetimeObject

ISO date format



13
# File 'lib/ndr_support/date_and_time_extensions.rb', line 13

alias orig_to_datetime to_datetime

#to_datetimeObject



15
16
17
18
19
# File 'lib/ndr_support/date_and_time_extensions.rb', line 15

def to_datetime
  # Default timezone for Date is GMT, not local timezone
  return in_time_zone.to_datetime if ActiveRecord::Base.default_timezone == :local
  orig_to_datetime
end

#to_isoObject

to_iso output must be SQL safe for security reasons



9
10
11
# File 'lib/ndr_support/date_and_time_extensions.rb', line 9

def to_iso
  strftime('%Y-%m-%d')
end