Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
moment().min is deprecated, use moment.max
moment().max is deprecated, use moment.min

This warning is not a typo, but it is confusing.

Previous to version 2.7.0, moment supported moment().min and moment().max functions. These functions were unintuitive.

Min would return the greater of the two moments in question, and max would return the lesser.

Due to this inverted behavior, the suggestion provided in the deprecation warning is correct.

//is equivalent to
moment.max(moment('2016-01-01'), moment('2016-02-01')).format()
//is equivalent to
moment.min(moment('2016-01-01'), moment('2016-02-01')).format()

See original GitHub issue.