henrypoydar / chronic_duration

A simple Ruby natural language parser for elapsed time
MIT License
351 stars 68 forks source link

Add output functionality in ISO 8601 format #38

Open ghost opened 9 years ago

ghost commented 9 years ago

Fixes #33 - just use :format => :iso.

I had to refactor the result map loop a bit for the special T operator in the middle of the output when an hour, minute, or second exists, but otherwise most of the other code is unaffected. I've also updated the documentation and added results to the spec file. There are some glitches that I'd like to fix if I had more free time (e.g. 0 input produces an output of P), but this is enough to satisfy my needs. I also didn't program the parsing portion so it will fail some checks.

I'm submitting this PR as a courtesy with a new version tag (v0.10.7), but please let me know if you'd like to see any improvements before including it in your code.

Cheers!