moment : Getting error when formatting date using user language
<p>I am getting this error when i tried to get a display for my date depending user lang using Moment JS library :</p>

<pre><code>format.replace is not a function 
</code></pre>

<p>Here is the code :</p>

<pre><code>var localeData = moment.localeData();

switch (navigator.language || navigator.userLanguage) {
    case 'fr':
        localeData = moment.localeData('fr');
        break;
}

localeData.longDateFormat('LL');

var dateToDisplay = moment(1459035326000, "x").format(localeData);
</code></pre>