javascriptluxon

Difference between duration units that end with an "s" or not (e.g. "day" vs. "days")


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.


Solution

  • They are the same.

    If you check the source for the Duration object you can see that there's a mapping which converts day to days, minute to minutes and so on for converting all singular time periods to plural.