I'm using momentjs with timezone.
I've converted date to i18n using moment.locale('pt');
Now I want to get timestamp of the date. I get date value as converted i18n date, i.e. Ago 14 2018 22:00
I tried with moment("Ago 14 2018 22:00").tz("Asia/Calcutta").unix()
=> this is returing NaN
But this is working => moment("Aug 14 2018 22:00").tz("Asia/Calcutta").unix()
So how can I get timestamp of converted i18n date??
Here is fiddle of the problem : http://jsfiddle.net/uq99udc9/10265/
You need to first specify a locale
as per momentJS documentation.
You also need to make sure you have that locale and if not import it.
Here is an example:
moment.locale('fr')
var date = moment("14 août 2018 10:37", "DD MMM YYYY hh:mm", "fr").format('LLL')
console.log(date);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/locale/fr.js" charset="UTF-8"></script>