I have tried in a thousand ways that I have seen in SOEn, but none works for me.
Here's an example of what I'm trying to do:
$( document ).ready(function() {
console.log(moment(new Date('2017-03-16')).format('dddd MMMM D'));
});
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/es.js"></script>
Here it works perfectly, but in my system NO, why would that happen? I am working with the same ones cdn
that I place in the example.
what must be specified is clearly, so that the library knows that when you use the
moment.lang("es")
or any language, it works for you wherever.In this way you can customize all the formats as you want, the function
split
that is at the end of each line indicates that after each _ it is a different format.A little late, but check out this information and documentation today. Just before the conversion import the language:
https://momentjs.com/docs/#/use-it/typescript/
https://momentjs.com/docs/#/use-it/typescript/
First you have to import the language you want to use: