I need help formatting a date in MomentJS
The main issue i am facing is that the Japanese “day” character 日
is not displaying
3 Nov
.11月 03
11月 03日
Format tried MMM DD
https://jsbin.com/caganaveci/edit?js,console
The format argument should be MMM Do
to append 日
to the day of month. 日
is the ordinal for the day of month.
moment.locale('ja');
console.log(moment().format('MMM Do'));
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/moment-with-locales.min.js"></script>
</body>
</html>
Just as an alternative, there is also toLocaleString:
console.log(new Date(2017,10,3).toLocaleString('ja',{month:'long',day:'numeric'}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With