Hi,
    The application is deployed on Heroku, is based on Ruby 3.2.1 and Rails
1.9.2. Sometimes a function of my props starts throwing this error  "
StringUtils:dateTimeFromString, str , *can't dup NilClass*"  and I don't
understand the cause. it's my function:

 require 'time'
module StringUtils
  DATE_FORMAT_YYYY_MM_DD='%Y-%m-%d'
  DATE_FORMAT_HH_MM_SS='%H:%M:%S'
  DATE_FORMAT_YYYY_MM_DD_HH_MM_SS='%Y-%m-%d %H:%M:%S'
  DATE_FORMAT_YYYY_MM_DD_T_HH_MM_SS='%Y-%m-%dT%H:%M:%S'
  DATE_FORMAT_YYYYMMDDHHMMSS='%Y%m%d%H%M%S'
  DATE_FORMAT_DAY_OF_WEEK="%A"


  def stringFormatDate(strDate,format)
    if strDate!=nil
      begin
        return Time.parse(strDate).strftime(format)
      rescue
        Rails.logger.error("StringUtils:stringFormatDate, str #{strDate},
#{$!}")
      end
    end
    return strDate
  end

*  def dateTimeFromString(strDate) *
    begin
      return Time.parse(strDate)
    rescue
       Rails.logger.error("StringUtils:dateTimeFromString, str #{strDate},
#{$!}")
       return nil
    end
  *end*
end


I hope your comments, Thanks

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to