If I understand this right then one of these fromNow and toNow functions should be used for dates in the past and the other for dates in the future? Could there be a new function like relative or something that determines which to use based on if the date provided is in the past or future? Would simplify the application logic.
No, the two functions just express opposite relationships:fromNow tells you the _date relative to now_ whereas toNow tells you how to express _now relative to the date_. IOW, what you're calling relative is just fromNow:
> moment("2016-05-25").fromNow()
'in 6 months'
> moment("2015-10-14").fromNow()
'a month ago'
I suspect toNow is rarely used...
Most helpful comment
No, the two functions just express opposite relationships:
fromNowtells you the _date relative to now_ whereastoNowtells you how to express _now relative to the date_. IOW, what you're callingrelativeis justfromNow:I suspect
toNowis rarely used...