Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
641 views
in Technique[技术] by (71.8m points)

datepicker - Localisation for the Netlify CMS UI Date Picker widget?

Is there any way to change to localisation of the Netlify CMS UI so the Date Picker widget is displayed in Monday-Sunday weeks and 24 hour times? I set the locale to ‘en-GB’ on the off-chance that would do it, but no luck.

I'm not looking to change the format of the output, but looking for the UI element to be formatted correctly for my locale. There is a hint to this being possible on the GitHub page, but I can't find how to set the config appropriately.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The sourcecode for the netlify datetime widget shows it uses react-datetime under the hood.

According to those docs, you can pass in a locale there, which is how you'd make monday the day of the week. I would suggest copying the netlify datetime widget (sourcecode here) modifying it to pull in the requirementrs correctly, and then passing in a locale as a prop to the DateTime widget within that.

(Previous answer was incorrect - I thought locales was the solution to this (it normally is with react-datetime), but the netlify locales are only for providing language translations, my bad.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...