Skip to content

parse of A/a doesn't work on other locales than en #1168

Closed
@xvaara

Description

Describe the bug

import dayjs from "dayjs";
import localizedFormat from "dayjs/plugin/localizedFormat";
import customParseFormat from "dayjs/plugin/customParseFormat";
import "dayjs/locale/fi";
import "dayjs/locale/zh-cn";
dayjs.extend(localizedFormat);
dayjs.extend(customParseFormat);

const input = "2018-05-02 01:02:03.004";

// this fails:
dayjs.locale("zh-cn")
const i2 = dayjs(input).format('YYYY年M月D日Ah点mm分')
console.log(i2,dayjs(i2,'YYYY年M月D日Ah点mm分'))

// this works
dayjs.locale("en")
const i3 = dayjs(input).format('YYYY年M月D日Ah点mm分')
console.log(i3,dayjs(i3,'YYYY年M月D日Ah点mm分'))

Expected behavior
Parse of A/a to work on non en locales.

Information

  • Day.js Version 1.9.4
  • OS: mac
  • Browser chrome
  • Time zone: +2

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions