beaussan / update-time-on-edit-obsidian

MIT License
169 stars 15 forks source link

Date Format Exception #85

Open Northern-Monk-e opened 2 months ago

Northern-Monk-e commented 2 months ago

Your plugin throws an exception - and stops working - telling me to use 'dd' instead of 'DD'! If I use 'dd' I get the short name of the day e.g. Thu when what I want is the number such as 10 for example. The format I'm using throughout Obsidian is 'yyyy-MM-DD-HHmm' which isn't that different from the Obsidian default 'YYYY-MM-DD' I was using 'YYYY' originally but your plugin complained about that also!

I'm on Ubuntu 24.04 LTS.

Other active plugins are:

  1. Dataview
  2. OZ Calendar, And
  3. Templater

Also, the plugin's date format section in options has vanished!

image

The Exception:

Uncaught RangeError: Use `dd` instead of `DD` (in `yyyy-MM-DD-HHmm`) for formatting days of the month to the input `Sat Aug 17 2024 17:33:16 GMT+0100 (British Summer Time)`; see: https://git.io/fxCyr
    at throwProtectedError (plugin:update-time-on-edit:2102:11)
    at eval (plugin:update-time-on-edit:2168:9)
    at Array.map (<anonymous>)
    at format (plugin:update-time-on-edit:2154:45)
    at createDoc (plugin:update-time-on-edit:5746:23)
    at UpdateTimeOnEditSettingsTab.createDateFormatEditor (plugin:update-time-on-edit:5752:88)
    at UpdateTimeOnEditSettingsTab.addDateFormat (plugin:update-time-on-edit:5722:10)
    at UpdateTimeOnEditSettingsTab.display (plugin:update-time-on-edit:5687:10)
    at t.openTab (app.js:1:2996677)
    at t.openTabById (app.js:1:2997259)
SamClayton commented 1 week ago

Can confirm this issue also affected my installation. I had to uninstall and reinstall to bring back the full options dialog. This case needs exception handling (and probably also input sanitization) so that, at minimum, the configuration UI still renders.