Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default date formatting #89

Closed
stigvi opened this issue Oct 29, 2022 · 19 comments · Fixed by #212
Closed

Default date formatting #89

stigvi opened this issue Oct 29, 2022 · 19 comments · Fixed by #212
Labels
enhancement New feature or request
Milestone

Comments

@stigvi
Copy link

stigvi commented Oct 29, 2022

As it is possible to format the date (great feature :-) ), is it possible to change the default formatting to "eee, P" and remove the hardcoded weekday at the start of the line?

@pkissling
Copy link
Owner

i initially wanted to do it, but figured that certain languages are not supported in date-fns. with your finding in #87 i realised that for other languages (czech, korean) the ISO 639-1 is wrong, hence translations via date-fns were not working.

i will consider it an enhancement and might implement it in future

@pkissling pkissling added the enhancement New feature or request label Oct 29, 2022
@stigvi
Copy link
Author

stigvi commented Oct 30, 2022

What about keep the default as it is now, but if date_pattern has some value configured by the user, then remove the hardcoded weekday? Default value will practically be like eee, P

@MicJour
Copy link
Contributor

MicJour commented Nov 1, 2022

There are characters in front of the date pattern.

8CAE2368-5349-4A5F-9AC2-C1F89B7678E7

65FBC13B-1C4E-4964-91FD-619481584C0C

@jleach87
Copy link

There are characters in front of the date pattern.

8CAE2368-5349-4A5F-9AC2-C1F89B7678E7

65FBC13B-1C4E-4964-91FD-619481584C0C

+1

@alexruffell
Copy link

alexruffell commented Dec 22, 2022

I believe the issue in this ticket also applies to PPPP as you end up with Thu, Thursday.... as shown below.

image

The initial Thu should not appear according to date-fns:

image

Also not sure why the date format doesn't match.

@claytonium13
Copy link

I have this same issue. Is there a workaround to fix the date pattern?

@alexruffell
Copy link

@claytonium13 I ended up using PPP which just shows short version of the week day. Works perfectly.

@dolby85
Copy link

dolby85 commented Apr 7, 2023

same issue here with "PPPP"

@mycana
Copy link

mycana commented Apr 21, 2023

Same issue here with EEEE MMMM d

@pkissling pkissling added this to the 2.0.0 milestone Apr 22, 2023
@pkissling
Copy link
Owner

pkissling commented Apr 22, 2023

i see that this is an annoying issue.

though fixing it would break downwards compatibility, as this might break the card for existing users who rely on the fact that the day is prepended to the date.

i'll add this ticket as a candidate for a new major version (2.0.0)

@roblatour
Copy link

roblatour commented May 7, 2023

I am having the same issue with PPPP
I understand that you are saying 'it would break downwards compatibility, as this might break the card for existing users who rely on the fact that the day is prepended to the date.' however to be fair it is already broken for existing users and a fix here would correct it and make it usable by all?

@m33ts4k0z
Copy link

m33ts4k0z commented Aug 5, 2023

Hello.

I can't see why is this such a breaking change that would mess the UI but removing this line:

${this.localize(`day.${e.getDay()}`)},

from clock-weather-card.js fixed it for me.

You can use the HA File Editor to edit the file from the web browser. After that you might need to suffix the resources entry with something like ?ver=2 in order to force the webbrowser to reload the file and ignore the cache.

Example:

/hacsfiles/clock-weather-card/clock-weather-card.js?ver=2

Result (date_pattern: PPPP):

fixed_weathercard

@GsynthChris
Copy link

same issue here, just used PPP. definitely not a huge deal.

@pkissling pkissling mentioned this issue Oct 3, 2023
Merged
@pkissling
Copy link
Owner

hey there, i just released a beta 2.0.0 which addresses the issue of having a hard coded weekday prepended to the date. please carefully read the changelog. there are other breaking changes, which might require your attention.

i'd appreciate some feedback whether this release solves your problems. cheers

@pkissling pkissling reopened this Oct 7, 2023
@alexruffell
Copy link

I installed the beta and all I had to do was replace PPP with DDDD and it is perfect. Thank you!

@pkissling
Copy link
Owner

released 2.0.0

@Nezz
Copy link

Nezz commented Oct 16, 2023

One downside I came across with the Luxon switch is that ordinals are no longer supported. do now outputs <day of the month><day of the year> instead of ordinal day of the month (i.e. 16th).

@agnus77
Copy link

agnus77 commented Oct 21, 2023

I have just updated to v2 and I have "invalid dateTime" using Wunderground forecast.

image
I have to set : hourly_forecast: true to show the forsecast

Previous version works fine and Wundergound expose the forecast correctly
image

Using another weather service, it works fine.
image

Someone can helps?

@pkissling
Copy link
Owner

I have just updated to v2 and I have "invalid dateTime" using Wunderground forecast.

image

I have to set : hourly_forecast: true to show the forsecast

Previous version works fine and Wundergound expose the forecast correctly

image

Using another weather service, it works fine.

image

Someone can helps?

can you call get_forecast service and paste the returned yaml here? i have the feeling that the weather provider uses a different date format than the other weather providers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.