gpt4 book ai didi

javascript - 如何将月份名称英语更改为阿拉伯语

转载 作者:行者123 更新时间:2023-12-03 20:45:50 26 4
gpt4 key购买 nike

在我的 codepen 链接下方,我有事件日历,它直接获取英文月份,但我想将其月份名称更改为阿拉伯语

例如:February 需要改成 "فبراير"

Codepen 链接:Click Here

$('.b-calendar__header .month').each(function() {
var text = $(this).text();
$(this).text(text.replace('February', 'فبراير'));
});

我试过这种方式,但没有用

请帮忙

最佳答案

希望对你有用

const formatter = new Intl.DateTimeFormat('ar', { month: 'short' });
const month1 = formatter.format(new Date());
console.log(month1);

关于javascript - 如何将月份名称英语更改为阿拉伯语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65697059/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com