marcinjakubowski / date-menu-formatter

Date Menu Formatter GNOME Shell extension
GNU General Public License v2.0
34 stars 15 forks source link

月 and 日 are always displayed in ja-JP. #20

Open Hackgets opened 1 year ago

Hackgets commented 1 year ago

When the locale is set to ja-JP, is it possible to not display "月" and "日" for month and day?

88-percent commented 9 months ago

same issue with zh-HK

I'm curious if D and M shouldn't return numeric only, while the longer strings should return characters.

ciscorucinski commented 9 months ago

What is the format that you want?

I wanted the Korean characters for everything (including the weekday EEEE and period aaa), so I needed to set the locale to ko-KR. There is no other way to achieve this with en-US.

If you don't want any Japanese characters, then you can achieve most formats with en_US

Locale: ko-KR
Format: ( EEEE )  MMM dd   hh : mm  aaa 
Output: ( 일요일 )  10월 01일   06 : 40  오후

Locale: en-US
Format: ( EEEE )  M월  dd일   hh : mm  aaa 
Output: ( Sunday )  10월 01일   06 : 40  PM
Hackgets commented 9 months ago

If the language is set to English, the days of the week are also set to English. For me that is not intuitive. D and M preferably return only numbers.

ciscorucinski commented 9 months ago

I see what you mean. You want the weekday, like Sunday, to be displayed in Japanese, but the month and day to be pure numeric.

I see that the hour, minute, and second do not add the locale-specific affixed characters at all, and the month and day always add the locale-specific affixed characters.

I'm not sure if the formats are working as intended or not; online documentation for non-en-US locale is hard to come by. But it would be nice to get pure numeric values for non-en-US locales.

ciscorucinski commented 9 months ago

It seems like being able to change the dateStyle and timeStyle within the GUI would allow for appending or removing the locale-specific character affixes.

I'm not fully sure if this will work within this extension, but it works in the below link if you change the locale, dateStyle, and timeStyle values.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat

88-percent commented 9 months ago

I'm not fully sure if this will work within this extension, but it works in the below link if you change the locale, dateStyle, and timeStyle values.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat

using the link you provided I'm able to get the numeric dates with local weekdays

The following returns: 1/10/2023(週日)

const date = new Date(Date.UTC(2023, 9, 01));

console.log(
  new Intl.DateTimeFormat('zh-HK', 
                          { year: "numeric",  
                           weekday: "short", 
                           month: "numeric",
               day: "numeric",}).
  format(date),
);
bomdia commented 3 months ago

@Hackgets @88-percent @ciscorucinski can you please confirm if with the last version and luxon formatter you keep having this problem

88-percent commented 3 months ago

@Hackgets @88-percent @ciscorucinski can you please confirm if with the last version and luxon formatter you keep having this problem

I'm on Gnome Shell v42 so unfortunately it looks like I'm unable to test anything higher than v10.