你可以使用 locale
获取或设置持续时间的区域设置。 语言环境会影响持续时间的字符串方法,例如 humanize()
。 有关国际化的更多信息,请参阅 国际化 部分。
This requires the
相对时间
plugin to work
require('dayjs/locale/es')
dayjs.duration(1, "minutes").locale("en").humanize();
dayjs.duration(1, "minutes").locale("es").humanize();