react-moment icon indicating copy to clipboard operation
react-moment copied to clipboard

Formatting throws an error

Open bjackson opened this issue 7 years ago • 1 comments

Whenever I try to format a date, an error is thrown: TypeError: TypeError: this.localeData(...).postformat is not a function.

This happens whenever I use format in the JSX element, or set global format like Moment.globalFormat = 'MM-DD HH:mm'

Any idea what might be causing it? Not specifying a format or not setting globalFormat doesn't throw the error.

bjackson avatar Mar 26 '18 01:03 bjackson

I've figured out what the issue is. If the argument to date is a Moment object, this will occur, however, if you just pass a JS Date object, it will work fine. Is this intended?

bjackson avatar Mar 26 '18 01:03 bjackson