Coder Social home page Coder Social logo

daniel-khodabakhsh / datetime-format Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 15.0 32 KB

Gnome extension which allows users to customise the datetime format on the status bar and date menu.

License: GNU General Public License v3.0

JavaScript 99.39% CSS 0.61%
gnome-shell-extension

datetime-format's People

Contributors

daniel-khodabakhsh avatar rgezikov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

datetime-format's Issues

Gnome 3.18

On Ubuntu 16.04 LTS with gnome-shell 3.18.5 it don't work as-is, but seems to can works somehow after tweaks.
What about porting it?

On gnome-tweak-tool:
(gnome-shell-extension-prefs:3068): Gtk-ERROR **: failed to add UI: .:5:1 Required gtk+ version 3.20, current version is 3.18

On gsettings: no schema.

Error: Failed to convert locale string to UTF8

Thanks for this very Useful Extension.
Generally this plugin works fine.

But after adding custom text in Bengali language, I got error When I click Datetime Format setting icon.

My Status bar datetime format string is:
আজ %A, %d %B %Y - %I:%M:%S %p

Error: Failed to convert locale string to UTF8: Invalid byte sequence in conversion input

Stack trace:

  dateTimeFormat@/home/username/.local/share/gnome-shell/extensions/[email protected]/Utilities.js:15
  create/updatePreview@/home/username/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:49
  create@/home/user/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:55
  buildPrefsWidget/<@/home/username/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136
  buildPrefsWidget@/home/username/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136
  Application<._selectExtension@resource:///org/gnome/shell/extensionPrefs/main.js:90
  wrapper@resource:///org/gnome/gjs/modules/lang.js:178
  Application<._onCommandLine@resource:///org/gnome/shell/extensionPrefs/main.js:238
  wrapper@resource:///org/gnome/gjs/modules/lang.js:178
  main@resource:///org/gnome/shell/extensionPrefs/main.js:376
  @<main>:1

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

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

Broken on Pop!_OS 20.04: extension.metadata.formatTargets is undefined

Installation source: GNOME Extensions
Installed on 2020-06-14

TypeError: extension.metadata.formatTargets is undefined

Stack trace:
  buildPrefsWidget@/home/baka/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:2
  _init@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:207:40
  OpenExtensionPrefsAsync/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:122:28
  asyncCallback@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:132:13
  run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:175:20
  main@resource:///org/gnome/Shell/Extensions/js/main.js:19:13
  run@resource:///org/gnome/gjs/modules/script/package.js:222:19
  start@resource:///org/gnome/gjs/modules/script/package.js:206:5
  @/usr/share/gnome-shell/org.gnome.Shell.Extensions:1:17

Restart not working

The instructions say:

Afterwards, restart gnome-shell by pressing Alt+F2, type in 'r', then press enter.

This doesn't restart gnome-shell for me, and instead starts Rhytmbox

Using Ubunutu 18.04

Broken in Ubuntu 19.04: TypeError: (new Date(...)).toLocaleFormat is not a function

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

Stack trace:
  dateTimeFormat@/home/sudoranger/.local/share/gnome-shell/extensions/[email protected]/Utilities.js:15:85
  updatePreview@/home/sudoranger/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:49:25
  create@/home/sudoranger/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:55:2
  buildPrefsWidget/<@/home/sudoranger/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:61
  buildPrefsWidget@/home/sudoranger/.local/share/gnome-shell/extensions/[email protected]/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

Extension Settings "Something's gone wrong", fresh Ubuntu 19.10 install

Completely fresh, first time ever, empty drive, 'Ubuntu 19.10 amd64' install
..
Processor: Instel Core i5-4310M CPU @ 2.70 x 4
Graphics: Quadro K2100M/PCIe/SSE2
GNOME: 3.34.2
OS type: 64-bit
Disk: 160.0GB
..
All updates then applied.
..
Then I wanted to change date & time format,
Follow suggestions to install this extension,
press 'Extension Settings' and get
"Something's gone wrong"
"We're very sorry .... [etc]"
Technical Details:
The settings of extension [email protected] had an error:

TypeError: extension.metadata.formatTargets is undefined

Stack trace:

buildPrefsWidget@/home/bryan/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:2
_showPrefs@resource:///org/gnome/shell/extensionPrefs/main.js:57:22
vfunc_command_line@resource:///org/gnome/shell/extensionPrefs/main.js:351:23
main@resource:///org/gnome/shell/extensionPrefs/main.js:707:5
@<main>:1:43

====
Different stack trace to #16
Different stack trace to #12

Extension not enabled after installation in Ubuntu 18.04

I struggled a bit to get the extension up and running and noticed that it was not enabled after installation. So either enable it through gnome-tweak-tool or run

$ gnome-shell-extension-tool  -e [email protected]

I'm not sure if this is gnome specifics or perhaps Ubuntu specifics so not sure how to update README properly, otherwise I would have done a PR instead of an issue.

Don't display seconds on Status Bar?

Thanks for the great extension. I am using it on Gnome 3.38 (MX Linux 21, based on Debian Buster).
This is my current format for the Status Bar
%r %A %B %d %Y
How can I hide the seconds?

Installed by

`git clone https://github.com/Daniel-Khodabakhsh/datetime-format.git

cd datetime-format

git checkout release

node --use_strict build.js`

How do I apply extension.json for Gnome 40?

Hello!

I have recently installed this extension on gnome 40 for fedora 34

however, after installation i am greeted with this
image

apparently there is an extension for gnome 40, how do I apply it so that it works?

Error after clicking "Extension Settings" for the addon in Ubuntu Software

The settings of extension [email protected] had an error:

TypeError: extension.metadata.formatTargets is undefined

Stack trace:

buildPrefsWidget@/home/htpc/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:2
_showPrefs@resource:///org/gnome/shell/extensionPrefs/main.js:57:22
_extensionsLoaded@resource:///org/gnome/shell/extensionPrefs/main.js:320:13
_scanExtensions/<@resource:///org/gnome/shell/extensionPrefs/main.js:298:13
asyncCallback@resource:///org/gnome/gjs/modules/overrides/Gio.js:132:13
main@resource:///org/gnome/shell/extensionPrefs/main.js:707:5
@<main>:1:43

Error when loading Preferences dialog.

I installed this extension in Ubuntu 18.10 using the Gnome Extensions web-site. When I tried to open the Preferences dialog in Gnome Tweak Tool to customize the format, I got the following error message and stack trace.

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

Stack trace:
  dateTimeFormat@/home/dave/.local/share/gnome-shell/extensions/[email protected]/Utilities.js:15:85
  updatePreview@/home/dave/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:49:25
  create@/home/dave/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:55:2
  buildPrefsWidget/<@/home/dave/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:61
  buildPrefsWidget@/home/dave/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:2
  _selectExtension@resource:///org/gnome/shell/extensionPrefs/main.js:83:22
  wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
  _onCommandLine@resource:///org/gnome/shell/extensionPrefs/main.js:235:17
  wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22
  main@resource:///org/gnome/shell/extensionPrefs/main.js:389:5
  @<main>:1:43

Cannot find gsettings schema as described in readme

I just installed Ubuntu 18.04 and was not able to set proper ISO8601 format for the date time in the top bar so I installed this plugin. In the readme it says that I can use the gnome-tweak-tool or use the gsettings but I can't find the proper schema with gsettings.

$ gsettings list-keys org.gnome.shell.extensions.datetime-format 
No such schema “org.gnome.shell.extensions.datetime-format”

$ gsettings list-schemas | grep date
com.ubuntu.update-notifier
com.ubuntu.update-manager
org.gnome.settings-daemon.plugins.datetime
org.gnome.desktop.datetime
$ gnome-shell --version
GNOME Shell 3.28.1

Any pointers towards a solution would be much appreciated.

Something's gone wrong

The settings of extension [email protected] had an error:

TypeError: extension.metadata.formatTargets is undefined

Stack trace:

buildPrefsWidget@/home/nikita/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:2
_init@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:207:40
OpenExtensionPrefsAsync/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:122:28
asyncCallback@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:132:13
run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:175:20
main@resource:///org/gnome/Shell/Extensions/js/main.js:19:13
run@resource:///org/gnome/gjs/modules/script/package.js:222:19
start@resource:///org/gnome/gjs/modules/script/package.js:206:5
@/usr/share/gnome-shell/org.gnome.Shell.Extensions:1:17

%p isn't working in the status bar

The AM/PM setting isn't working. For instance a date like %I:%M:%S shows properly as 12:00:00 but a date like %I:%M:%S %p shows as a literal string.

Ubuntu 18.04

TypeError: extension.metadata.formatTargets is undefined

The settings of extension [email protected] had an error:

TypeError: extension.metadata.formatTargets is undefined

Stack trace:

buildPrefsWidget@/home/jumpnett/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:2
_showPrefs@resource:///org/gnome/shell/extensionPrefs/main.js:57:22
_extensionsLoaded@resource:///org/gnome/shell/extensionPrefs/main.js:320:13
_scanExtensions/<@resource:///org/gnome/shell/extensionPrefs/main.js:298:13
asyncCallback@resource:///org/gnome/gjs/modules/overrides/Gio.js:132:13
main@resource:///org/gnome/shell/extensionPrefs/main.js:707:5
@<main>:1:43

Gnome 42.4

just upgraded to ubuntu 22.04
gnome-shell --version = 42.4

This extension stopped working:

TypeError: extension.imports.Settings.Class is not a constructor

Anyone have a fix, or an alternative?

Can't install

Hello, thank you for this extension, however it doesn't install.

1) Warning about remote HEAD during git clone

git clone https://github.com/Daniel-Khodabakhsh/datetime-format.git
Clonage dans 'datetime-format'...
remote: Counting objects: 34, done.
remote: Total 34 (delta 0), reused 0 (delta 0), pack-reused 34
Dépaquetage des objets: 100% (34/34), fait.
Vérification de la connectivité... fait.
warning: la HEAD distante réfère à une référence non existante, impossible de l'extraire.

2) Error about missing module during node build

node build.js
module.js:471
    throw err;
    ^
Error: Cannot find module '/home/alex.dws/Téléchargements/_autres/datetime-format/build.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Broken in pop!_os 19.04, "The settings for this extension can't be displayed", TypeError: (new Date(...)).toLocaleFormat is not a function

just installed on
system: pop!_os 19.04,
gnome: 3.32.2,
nodejs: 10.15.2,

got the error when I tried accessing the extension settings through Tweaks -> Extensions

https://i.imgur.com/RUbvfCL.png

details:

The settings of extension [email protected] had an error:

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

Stack trace:

dateTimeFormat@/home/andrew/.local/share/gnome-shell/extensions/[email protected]/Utilities.js:15:85
updatePreview@/home/andrew/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:49:25
create@/home/andrew/.local/share/gnome-shell/extensions/[email protected]/FormatTarget.js:55:2
buildPrefsWidget/<@/home/andrew/.local/share/gnome-shell/extensions/[email protected]/prefs.js:136:61
buildPrefsWidget@/home/andrew/.local/share/gnome-shell/extensions/[email protected]/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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.