Create a date duration from a string
Rails can parse ISO8601 date durations (PnYnMnDTnHnMnS) or ranges compatible for postgres daterange types:
ActiveSupport::Duration.parse("P1Y3M2D").parts
=> {:years=>1, :months=>3, :days=>2}
Rails can parse ISO8601 date durations (PnYnMnDTnHnMnS) or ranges compatible for postgres daterange types:
ActiveSupport::Duration.parse("P1Y3M2D").parts
=> {:years=>1, :months=>3, :days=>2}