henrypoydar / chronic_duration

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

parse(keep_zero: true) treats empty strings like 0 #48

Open regentgal opened 5 years ago

regentgal commented 5 years ago
[50] pry(main)> ChronicDuration.parse("   ")
=> nil
[51] pry(main)> ChronicDuration.parse("   ", keep_zero: true)
=> 0

I believe that empty strings should still be treated as invalid and return nil. There is a difference between not entering anything and explicitly entering 0.

shepmaster commented 5 years ago

It also treats strings like "cow" as 0