question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Locale DateTime format not used in NDatePicker (input inside the dropdown) + update fr-FR locale date separator

See original GitHub issue

TuSimple/naive-ui version (版本)

2.21.5

Vue version (Vue 版本)

3.2.24

Browser and its version (浏览器及其版本)

N/A

System and its version (系统及其版本)

N/A

Node version (Node 版本)

Reappearance link (重现链接)

https://www.naiveui.com/en-US/os-theme/components/date-picker

Reappearance steps (重现步骤)

Choose fr-FR locale, open NDatePicker dropdown, then pick a date: the date input inside the dropdown is still using en-US locale.

Expected results (期望的结果)

Locale DateTime format used in NDatePicker (input inside the dropdown)

Actual results (实际的结果)

That input is still using the default en-US locale

Remarks (补充说明)

Oups! I just notice that, in my previous issue #1751, I miss the date separator (/ instead of -) in my translation, it should be:

{
  Time: {
    dateFormat: "dd/MM/yyyy",
    dateTimeFormat: "dd/MM/yyyy HH:mm:ss"
  }
  DatePicker: {
    monthTypeFormat: "MM/yyyy",
    dateFormat: "dd/MM/yyyy",
    dateTimeFormat: "dd/MM/yyyy HH:mm:ss"
  }
}

Really sorry, my bad 😞

Also, I guess the input field inside NDatePicker should probably respect the locale format too: image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
07akionicommented, Dec 9, 2021

@M1CK431 In fact the date-time’s panel doesn’t follows dateFormat now, we will try to fix it.

0reactions
wc-matteocommented, Dec 23, 2021

I was missing monthBeforeYear: true in my custom locale file

Read more comments on GitHub >

github_iconTop Results From Across the Web

Locale DateTime format not used in NDatePicker (input ...
Choose fr-FR locale, open NDatePicker dropdown, then pick a date: the date input inside the dropdown is still using en-US locale. Expected ...
Read more >
Get Locale Short Date Format using javascript
This is not a solution to obtaining the format string, but you can use ((new Intl.DateTimeFormat()).format(new Date()); to get a formatted date string....
Read more >
<input type="datetime-local"> - HTML - MDN Web Docs
The format of the date and time value used by this input type is described in Local date and time strings in Date...
Read more >
DatePicker | NG-ZORRO - Ant Design
Angular DatePicker Component, To select or input a date.By clicking the input box, you can select a date from a popup calendar.Note: Some...
Read more >
Text function in Power Apps - Power Platform
The Text function formats a number or a date/time value based on one of ... Use this to pass non-text values to text-based...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found