module MotionModelResource::DateParser

Public Class Methods

date_formatter() click to toggle source
# File lib/motion-model-resource/date_parser.rb, line 14
def self.date_formatter
  @date_formatter ||= NSDateFormatter.new
end
parse_date(arg) click to toggle source
# File lib/motion-model-resource/date_parser.rb, line 3
def self.parse_date(arg)
  return nil if arg.blank?
  additional_parsestring = arg.include?(".") ? ".SSS" : ""
  date_formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss#{additional_parsestring}ZZZZ"
  date = date_formatter.dateFromString arg

  return nil if date.blank?

  "#{date.description}"
end