[英]Format time zone to Vi Locale use Moment in React-Native
i am having a date problem when using Moment in React-Native.我在 React-Native 中使用 Moment 时遇到日期问题。 Specifically, after I formatted the date to en locale, but now I want it to support the locale in my country is vi locale as well:
具体来说,在我将日期格式化为 en 语言环境之后,但现在我希望它支持我所在国家/地区的语言环境也是 vi 语言环境:
Moment('2022-09-02T02:00:00+00:00')
.local()
.format('dddd, DD MMM);
the out put:输出:
Friday, 02 Sep
But I want the above result about our language in Vietnam as follows:但我想要关于我们在越南的语言的上述结果如下:
Thứ 7, 02 tháng 9
i tried as follows:我尝试如下:
Moment('2022-09-02T02:00:00+00:00')
.local()
.format('dddd, DD MMM).locale('vi')
But it not slove this issue, so Does you guys help me this issue: Thanks,但它不能解决这个问题,所以你们帮我解决这个问题:谢谢,
not same as you want but problem is you have to import localization
also.与您想要的不同,但问题是您还必须导入
localization
。
import moment from "moment";
import vi from "moment/locale/vi";
import fr from "moment/locale/fr";
const newVi = moment("2022-09-03T02:00:00+00:00").locale("vi", vi).format("dddd D, MMMM");
console.log(newVi);
const newFr = moment("2022-09-03T02:00:00+00:00").locale("vi", fr).format("dddd D, MMMM");
console.log(newVi);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.