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

Broken in Fedora 29 due to removal of Date.toLocaleFormat() #13

Open
danieljrmay opened this issue Dec 5, 2018 · 7 comments
Open

Broken in Fedora 29 due to removal of Date.toLocaleFormat() #13

danieljrmay opened this issue Dec 5, 2018 · 7 comments

Comments

@danieljrmay
Copy link

First of all thank you so much for this excellent extension. I really like it as I can't remember what year it is these days!

Unfortunately the removal of Date.toLocaleFormat() — which is used in the Utilities.dateTimeFormat(format, defaultFormat) function— has broken this extension.

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleFormat

I have forked your project and created a partial fix by essentially doing a limited re-implementation of Date.toLocaleFormat(). You can see my efforts at:

https://github.com/danieljrmay/datetime-format

The changes are to Utilities.dateTimeFormat(format, defaultFormat) and a new file DateTimeFormatter.js which contains my limited re-implementation of Date.toLocaleFormat().

Although this does get the extension working, there are still a number of things which would have to be done before we get it production ready including:

  • Update the format documentation which appears on in the "Format Options" panes of the UI.
  • Add i18n to the strings generated by DateTimeFormatter.js.
  • Give all this new code a good test.
  • Stuff I haven't thought of!

How would you like to proceed? I could issue a pull-request for what I have done so far, or I could carry on trying to get a "production ready" version before issuing the pull request. Or perhaps you have a different view on how this should all be done?

Thank you again for all your work on this.

Best wishes,

Dan

@christofferholmstedt
Copy link

christofferholmstedt commented Jan 12, 2019

I cloned your changes from https://github.com/danieljrmay/datetime-format , the release branch and it solved my problem for loading the extension settings page that didn't work at all on my new Ubuntu 18.10 installation (see #12).

Though I'm now experiencing some issues with the format I use: %Y-%m-%dT%H:%M:%S%z

  • Month is not properly displayed ("00" instead of "01" for January)
  • Timezone does not work anymore. %z is printed instead of the proper timezone.

Any ideas what this could be caused by?

--- EDIT ---
Just took a look at the source code and more specifically the changes at danieljrmay@ab34e68#diff-3536874582afc79fb041cab92d9d46dbR15 %z does not seem to be implemented and "m" might be parsed wrong. Will take a closer look.

@christofferholmstedt
Copy link

Sent a first pull request to you @danieljrmay regarding month format at danieljrmay#1

@christofferholmstedt
Copy link

christofferholmstedt commented Jan 12, 2019

Sent a second pull request to you @danieljrmay regarding %z functionality danieljrmay#2. It is quick and dirty, not sure if you have any better idea on how to solve that issue properly.

I have pushed both of my changes into https://github.com/christofferholmstedt/datetime-format/tree/master

--- EDIT ---
As reference https://stackoverflow.com/a/15304657

@danieljrmay
Copy link
Author

Hi Christoffer!

Sorry not to get back to you sooner, been a bit busy over the last few days. However, I wanted to acknowledge all your comments and contributions! I will have a chance to have a proper look at everything later this week and I will give you a proper response then. ;-)

Best wishes, Dan

@ghost
Copy link

ghost commented Apr 20, 2019

Is this extension dead since there's still no update/reply 3 months later? That's a shame because I really like and use it in all my fresh installation of Ubuntu 18.04.2. It crashes in the latest 19.04 (gnome 3.32)

@danieljrmay
Copy link
Author

Hi @sudoranger

Is this extension dead since there's still no update/reply 3 months later? That's a shame because I really like and use it in all my fresh installation of Ubuntu 18.04.2. It crashes in the latest 19.04 (gnome 3.32)

I haven't had a response from @Daniel-Khodabakhsh the original author of this great little extension since I posted this issue. I forked the repository and have fixed the issue which prevented it running in my Fedora 29. @christofferholmstedt also added a couple of fixes to this fork and I think he had it running in a recent Ubuntu, not sure which version. You could give the fork a go and see if it works for you:

https://github.com/danieljrmay/datetime-format

@lorenzleutgeb
Copy link

Installed today via https://extensions.gnome.org/extension/1173/datetime-format/ on GNOME Shell 3.32.2 on Fedora 30 and got:


The settings of extension datetime-format@Daniel-Khodabakhsh.github.com had an error:

TypeError: (new Date(...)).toLocaleFormat is not a function

Stack trace:

dateTimeFormat@/home/lorenz/.local/share/gnome-shell/extensions/datetime-format@Daniel-Khodabakhsh.github.com/Utilities.js:15:85
updatePreview@/home/lorenz/.local/share/gnome-shell/extensions/datetime-format@Daniel-Khodabakhsh.github.com/FormatTarget.js:49:25
create@/home/lorenz/.local/share/gnome-shell/extensions/datetime-format@Daniel-Khodabakhsh.github.com/FormatTarget.js:55:2
buildPrefsWidget/<@/home/lorenz/.local/share/gnome-shell/extensions/datetime-format@Daniel-Khodabakhsh.github.com/prefs.js:136:61
buildPrefsWidget@/home/lorenz/.local/share/gnome-shell/extensions/datetime-format@Daniel-Khodabakhsh.github.com/prefs.js:136:2
_selectExtension@resource:///org/gnome/shell/extensionPrefs/main.js:75:22
_onCommandLine@resource:///org/gnome/shell/extensionPrefs/main.js:320:17
main@resource:///org/gnome/shell/extensionPrefs/main.js:635:5
@<main>:1:43

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

No branches or pull requests

3 participants