Using Luxon.js, is there a difference between duration units that end with an "s" and those that do not?
For example:
DateTime.now().plus({ day: 1 });
vs.
DateTime.now().plus({ days: 1 });
My tests seem to indicate that there is no difference, but I want to be sure. I haven’t found anything in the documentation about this.
2
Answers
They are the same.
If you check the source for the
Duration
object you can see that there’s a mapping which convertsday
todays
,minute
tominutes
and so on for converting all singular time periods to plural.Poking through the source, if you pass an object to
plus
, that eventually gets standardized here to the plural form:The object is given to
Duration.fromObject
, and then given to the above function.