在日语中需要帮助在MomentJS中格式化日期 [英] Need help formatting a date in MomentJS in Japanese

查看:220
本文介绍了在日语中需要帮助在MomentJS中格式化日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在MomentJS中格式化日期的帮助

I need help formatting a date in MomentJS

我面临的主要问题是日语"day"字符没有显示

The main issue i am facing is that the Japanese "day" character is not displaying

  • 日期:3 Nov.
  • 实际输出:11月 03
  • 预期输出:11月 03日
  • Date: 3 Nov.
  • Actual Output: 11月 03
  • Expected Output: 11月 03日

尝试过格式MMM DD

https://jsbin.com/caganaveci/edit?js,console

推荐答案

解决方案

format参数应该为MMM Do,以便将附加到月份中的某天. 是月份中的第几天.

Solution

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>

这篇关于在日语中需要帮助在MomentJS中格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆