The parse method in Ruby favours US mm-dd-yyyy date formats over European style dd-mm-yyyy formats. Ruby on rails uses the parse method to process Dates from String to Date objects, particularly in form processing. As a result, you need a heavy weight library or some pretty ugly string bashing to parse European formats by default.
Here's code I put together for Ruby 1.8.6 and 1.8.7 that will allow you to parse European dates by default. Throw this code in config/initializers/time_parsing.rb
module Date::Format::EuropeanDates
def self.included(base)
base.class_eval do
class << self
if RUBY_VERSION == '1.8.6'
# From here: http://fatvegan.com/2008/05/27/european-dates-in-ruby-on-rails/
alias_method :_parse_sla_us, :_parse_sla_eu
else
# Rewrite Ruby's _parse_sla method.
def _parse_sla(str, e) # :nodoc:
if str.sub!(%r|('?-?\d+)/\s*('?\d+)(?:\D\s*('?-?\d+))?|n, ' ') # '
s3e(e, $3, $2, $1)
true
end
end
end
end
end
end
end
Date.send(:include, Date::Format::EuropeanDates)
The fuzzy brown bit is what we don't know. The fuzzy brown bit disappears randomly because we don't know what we don't know.
In order to process information within these two worlds we need two different sets of tools...
We need analytical tools to process what we know and creative tools to process what we don't know.
How do you process what you don't know? This might be a hint...
Inference is the process of logical deduction. Extrapolation is the process of exploration.
Everyone is familiar with processing what we know. The world is heavily biased to this concept. School is heavily biased in this direction. It's quantitative, easy to measure, and provable based on prior measurements.
Creativity is based in that part of the world that we don't know. Creative territory requires imagination to reach. There is a clear change in paradigm between wading in the analytical pool, and floating in the creative abyss.
Unfortunately in our world, creativity plays second to the analytical. Creativity is hard to measure, prove, and teach. People fear the unknown. Creativity is harder to translate in to Return On Investment.
Here's the truth...
Analytics and creativity are symbiotic. One doesn't survive without the other. Analytics processes what we know, and creativity finds stuff to know.
Part of this idea is illustrated here...
The truth finder represented by the circle is simply "some process" that finds truth from ideas. This is only part of the story though, knowledge spurs creativity...
Creativity depends on knowledge, and vice versa. Analytics and creativity are just tools to process the known and unknown.
A business that ignores creativity will become obsolete, stale, broke.
A company that ignores analytics will never gain traction, floating, useless.
All very well, and maybe even correct. But, how does this help you?
Creatives: Spend more time grounded. Perhaps, take time to look at your market, your finances, your place within this world. Drop your pretensions.
Analyticals: Take time to dream. Drop your assumptions, ignore your fears of the unknown, leave your ego behind.
Embrace what you don't know.