Moment.js - Deprecation warning

Hi! I’m using a database with a javascript Date() value and when I use it in moment with this code:

<p id="relativetime"></p>
<script>
    $("#relativetime").text(moment("Sun Aug 30 2020 15:58:59 GMT+0000 (Coordinated Universal Time)").fromNow());
</script>

I get this warning:

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to Moment.js | Guides for more info.

How do I convert it or whatever so it won’t work in the future?

Yikes! That took a long time! I ended up figuring out I need to use these:
https://momentjs.com/docs/#/parsing/string-format/
Took so long, but I figured it all out. If anyone needs it here it is:

"ddd MMM DD YYYY HH:mm:ss Z+HHmm"
3 Likes