I just ported it from the original, didn't think too much about it. I mainly wanted it for http://pkg.julialang.org/, which is at the hours/days/months/years time scale, and its good for that. I'd definitely think the most consistent thing would be precise (down to seconds), and approximate (only largest unit, which is mostly what it is now except for the year/month thing).
On Thursday, October 2, 2014 11:37:47 AM UTC-4, Stefan Karpinski wrote: > > I was going to ask about that too. Or maybe "about a minute". It seems > like there are two things going on there: humanized expression which is > still precise "one minute and ten seconds" versus approximate humanized > expression "about a minute". Separate functions or maybe an option? > > > On Oct 2, 2014, at 2:11 AM, Michele Zaffalon <[email protected] > <javascript:>> wrote: > > Why is timedelta(70) one minute but the last command timedelta(Date(2014,3,7) > - Date(2013,2,4)) one year and one month? Should it not be more consistent > to have one minute and 10 seconds in the first case? Besides, 10 seconds in > one minute in percentage is more than 1 month in 1 year... > michele > > On Thu, Oct 2, 2014 at 4:14 AM, Iain Dunning <[email protected] > <javascript:>> wrote: > >> Hi all, >> >> Announcing... >> >> *Humanize.jl* >> https://github.com/IainNZ/Humanize.jl >> >> Humanize numbers, currently: >> * data sizes >> * Date/datetime differences >> >> This package is MIT licensed, and is based on jmoiron's humanize Python >> library <https://github.com/jmoiron/humanize/>. >> >> Installation: Pkg.add("Humanize") >> >> Examples: >> >> julia> datasize(3000000) >> "3.0 MB" >> julia> datasize(3000000, style=:bin, format="%.3f") >> "2.861 MiB" >> julia> datasize(3000000, style=:gnu, format="%.3f") >> "2.861M" >> julia> timedelta(70) >> "a minute" >> julia> timedelta(0,0,0,23,50,50) >> "23 hours" >> julia> timedelta(DateTime(2014,2,3,12,11,10) - >> DateTime(2013,3,7,13,1,20)) >> "11 months" >> julia> timedelta(Date(2014,3,7) - Date(2013,2,4)) >> "1 year, 1 month" >> > >
