alibaba / react-intl-universal

Internationalize React apps. Not only for Component but also for Vanilla JS.
1.33k stars 154 forks source link

Test case failed in date format #152

Closed ruoqianfengshao closed 2 years ago

ruoqianfengshao commented 3 years ago

When i run npm run test, one test case was failed. image

IntlMessageFormat’s default time options is

time: {
    short: {
        hour: 'numeric',
        minute: 'numeric',
    },
    medium: {
        hour: 'numeric',
        minute: 'numeric',
        second: 'numeric',
    },
    long: {
        hour: 'numeric',
        minute: 'numeric',
        second: 'numeric',
        timeZoneName: 'short',
    },
    full: {
        hour: 'numeric',
        minute: 'numeric',
        second: 'numeric',
        timeZoneName: 'short',
    },
},

if test case expected to get 24 hour format time, should transfer hour12 as time params. maybe like this:

intl.init({ locales, currentLocale: "zh-CN", formats: {time: {medium: {hour12: false}}} });

And this will lead to pass all test cases.

cwtuan commented 2 years ago

fixed in v2.5.3.