【问题标题】:React Intl Date Format to get specific date formatReact Intl Date Format 以获取特定的日期格式
【发布时间】:2020-04-05 13:57:36
【问题描述】:

我正在使用 React Intl 日期格式化 API

https://github.com/formatjs/react-intl/blob/master/docs/API.md#date-formatting-apis

我想要这种格式的日期

August 7, 2019

基本上国际日期没有以下格式。这是我尝试过的

<FormattedDate
  year: 'numeric',
  day: '2-digit',
  month: 'long',
/>

我如何获得这种格式 - August 7, 2019 格式以在 React Intl 格式化日期 API 中使用

【问题讨论】:

    标签: javascript reactjs date react-intl intldateformatter


    【解决方案1】:

    你可以这样做

    <FormattedDate
      value={new Date()}
      year="numeric"
      month="long"
      day="2-digit"
    />
    

    【讨论】:

      猜你喜欢
      • 2017-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-27
      • 1970-01-01
      相关资源
      最近更新 更多