Daniel-Khodabakhsh / datetime-format

Gnome extension which allows users to customise the datetime format on the status bar and date menu.
GNU General Public License v3.0
30 stars 15 forks source link

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

Open danieljrmay opened 5 years ago

danieljrmay commented 5 years ago

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:

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 commented 5 years ago

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

Any ideas what this could be caused by?

--- EDIT --- Just took a look at the source code and more specifically the changes at https://github.com/danieljrmay/datetime-format/commit/ab34e68a9fc15c778c87c051c8a8235604714ec5#diff-3536874582afc79fb041cab92d9d46dbR15 %z does not seem to be implemented and "m" might be parsed wrong. Will take a closer look.

christofferholmstedt commented 5 years ago

Sent a first pull request to you @danieljrmay regarding month format at https://github.com/danieljrmay/datetime-format/pull/1

christofferholmstedt commented 5 years ago

Sent a second pull request to you @danieljrmay regarding %z functionality https://github.com/danieljrmay/datetime-format/pull/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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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