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

[Feature Request] Easy date insert #115

Open
jebbster88 opened this issue Mar 8, 2021 · 6 comments
Open

[Feature Request] Easy date insert #115

jebbster88 opened this issue Mar 8, 2021 · 6 comments
Labels
feature request New feature or request

Comments

@jebbster88
Copy link

jebbster88 commented Mar 8, 2021

Is your feature request related to a problem? Please describe.
I have a document where I add an entry every day, with headers of the form ## Monday 15th Feb, it got tedious entering the dates.

Describe the solution you'd like
A shortcut for entering the current date similar to the markdown shortcuts. E.g.

/d -> 08/03/2021
/D -> Monday, 08 March, 2021

Additional context
I took d and D as based on the .Net string formatting spec https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings

Could possibly take it even further and allow something like /d"a format string" but that seems like possible overkill.

@dhda
Copy link

dhda commented Mar 9, 2021

What platforms do you use? I have this need as well for journaling, but I solve it across different apps using system-wide shortcuts. On iOS I have a handful of Shortcuts workflows for formatting the current date in different ways that lets me do it in any app by just swiping down, tapping a button, and then pasting. On MacOS I have a similar shortcut in Alfred that lets me quickly paste the date with just three or four keystrokes (and it would be easy to do it in a single keystroke). Windows has similar potential—I’ve heard of AutoHotKey before though I’ve never used it myself—and most Linux GUIs should make it similarly easy to set up a hotkey to a shell script that formats the date and copies it to the clipboard.

@jebbster88
Copy link
Author

Totally could knock up a rofi plugin for that on my laptop, my phone less so, unless I want to use one of the less privacy friendly android keyboards. But it would be nice to have a consistent approach between devices.

@ghost
Copy link

ghost commented Mar 9, 2021

But it would be nice to have a consistent approach between devices.

Agreed. I would love to have a shortcut directly in cryptee - for journaling and work.
I actually use AutoHotKey currently and while this works well, it's not a solution for non-tech-savvy people. Besides, AutoHotKey has to run in the background all the time for the shortcuts to work.

@johnozbay
Copy link
Member

Hello all! 👋🏻

Thanks a lot for filing this @jebbster88, and thanks a lot for chiming in everyone!

While I can see that this would be incredibly useful, I'm not sure if there's a good way to implement this without causing confusion or internationalization issues.

/d would work for most languages with latin-roots since "d" can mean "Date" (EN/FR/etc) or "Datum" (SE/DE/NL/etc), but in Spanish date is "fecha", in Finnish it's "päivämäärä", in Turkish it's "tarih" etc. So I think it's generally a bad idea to trigger 'typed' shortcut actions based on the first letter, and better to use symbols instead like #, @ , $ etc. In my opinion it's more okay to use letters for hotkey-combinations like : alt + shift + d, since that's more about muscle-memory. (plus, all software, incl operating systems use this, so I think everyone's more used to this idea)

More importantly, what if you want to type something like "Jack/Daisy"? or "jebbster/dhda"?
This would cause a ton of edge-case problems in the editor.

Finally, date formatting in general is an international standardization nightmare (which seriously makes me wonder how the hell humanity managed to agree on "seconds" and "hours" internationally in the first place) i.e. :

April 21, 2021 written in different countries :

in US :
04/21/2021 or April 21, 2021 (mm dd, yyyy)

in France :
21.04.2021 or in written 21 avril 2021 (dd mm yyyy)

in Finland :
21.04.2021 or in written 21. huhtikuuta 2021 (dd. mm yyyy)

etc.
it's a nightmare. 😩

Browsers help abstract a large part of this with date functions, and we even utilize browsers' built in date formatting for the new document input for example. But it only makes sense to use these if the user can see what the result will be when they type "/d" for example. Otherwise, you don't know which format the date will be outputted. is it the Apr 21, 2021, or April 21, 2021, or 04/21/2021 etc etc.

So perhaps to solve all this, I could add an "insert date" hotkey, which opens a dropdown / popup just like the insert tag popup. You can open it with something like : "alt+shift+d" etc. The popup can have a pre-populated list of dates written in 4 - 5 most common formats using the browser's built in date locale. So a popup in US would look like :

--

  1. 04/21/2021
  2. 2021-04-21
  3. April 21, 2021
  4. 21 April 2021
  5. Apr 21 2021
  6. 21 Apr 2021

--

And once it's open you can use either the arrow keys or the number keys to select & insert one. How does this sound?
– personally I think it would be overkill and would require too much cognitive effort to pick and choose a date this way.

Would love to know what you think, and whether if you have a better solution that works internationally.
I'm all open for ideas. ✌🏻

@johnozbay johnozbay added the feature request New feature or request label Mar 21, 2021
@ghost
Copy link

ghost commented Mar 21, 2021

Would is be possible to store the date format in the settings? So you can choose from different formats and save this setting, like the other settings, on device.
So when you press alt+shift+d it just inserts the date in the format you choose in the settings.

@jebbster88
Copy link
Author

A date insertion menu would be perfect, however the problem with using a chord for the shortcut is that it would make it difficult to use on mobile (where its going to be most useful IMO), unless you're also envisioning another editor button for date?

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

No branches or pull requests

3 participants