22.00.0094: Don’t type the date by hand

https://johnnydecimal.com/20-29-communication/22-blog/22.00.0094-dont-type-the-date-by-hand/

On Discord, Jade asked:

Theres gotta be a better way of naming Amex (and other credit card statements) than this surely? I always struggle to remember the dates, but this just feels overwhelming, I usually just go with the statement date for naming credit card statements. Amex Ending 12345 - 2024 10 10 to 2024 11 09 - Statement 2024 11 09 - Due 2024 12 05

There are many situations where I recommend starting a filename (or folder) with the date. It works really well for almost any time-based document. Amex statements fall squarely in to that bucket.

Which date?

For the record, this is the ISO 8601 date standard. Once you get in to date formatting[1] you’ll see that around, so it’s good to know what it is.

That standard defines a bunch of formats, but the one we’re interested in is the simple yyyy-mm-dd, i.e. 2024-11-21. It’s the only sensible format for your computer dates as it sorts chronologically. Use whatever other weird crap you want in your personal life.

The problem with this date is that it’s a real pain to type out by hand. And first you have to remember the date! Bo-ring. Fortunately computers are good at a) knowing the date and b) generating text.

Introducing Raycast

You’re gonna need an app. There are many that do this. The venerable TextExpander might have been the first, but we’re going to use a reasonably new app: Raycast.

Raycast is a beast. It does so much. But don’t let that put you off – we can start to use it for the stuff we need, and over time you can explore the rest of its features.

It’s free. There’s a pro plan, but you don’t need it. It’s currently Mac only, but they’re working on a Windows version.

So, install it. You can test it’s working by pressing Option-Space. A little window should appear in the middle of your screen.

I won’t go over any other Raycast features just now. The manual is here.

Snippets

We’re going to create a ‘snippet’. How this works is that you type some sort of shortcut, and Raycast converts it to something else.

It’s just like the feature on your iPhone that detects if you typed teh and corrects it to the. Or the one that corrects █uck to duck. You know.

There’s a trick here, and it’s in naming your snippets. You want to guarantee that whatever you type will never ever occur in normal daily typing. Because if your snippet trigger was al, every time you type that out Raycast will replace it for you.

So now instead of Johnny.Decimal you’ll get Johnny.Decim2024-11-21. Not ideal.

I recommend ;;

I think this came from Merlin Mann waaaay back in the 43 folders days (2005!).[2] If you start each of your snippets with two semicolons, you guarantee that you’ll never trigger them by accident.

If you touch-type[3] they’re under your right pinkie. So you mash ;; and then the name of your snippet and boom Raycast steps in and replaces it with something else.

Let’s drop a little video here in case you’re wondering what I’m on about.

Link to video (dark mode version).

Raycast: Create Snippet

Cool eh! Let’s set it up.

  1. Activate Raycast with ⌥ Space. Type create snippet to find that command. Press return.
  2. The Name helps you identify it in the future.[4] Call it YYYY-MM-DD or whatever else you like.
  3. The Snippet is what will appear when this is activated. Paste this in: {date format="yyyy-MM-dd"}. This is a little bit of code that Raycast understands. Include the curly brackets.
  4. Scroll the window to reveal Keyword. This is what you type to activate this snippet. I’d recommend ;;date for this one.
  5. Press ⌘ return to save it.
  6. Try it out!

Problem: it’s today’s date

As Jade is renaming lots of old files, this isn’t perfect. But honestly I find even having the skeleton of a date format that I can then edit is more useful than starting from nothing.

Tip: use option-arrows to move around

Another small computer power-user tip: hold option (alt on Windows) and use the left/right arrows. This jumps your cursor a word at a time, and it stops at the breaks between the numbers in the date.

This will speed up your editing.

Why stop there?

In Jade’s specific case, where she wants yyyy-mm-mm Amex 12345, there’s nothing stopping you creating another custom snippet for that whole piece of text.

Repeat the process but now the Snippet should read {date format="yyyy-MM-dd"} Amex 12345. Maybe give that one the keyword ;;ax1? Whatever makes sense to you.

We can do so much more with Raycast, but that’s a good start. Let us know how that works for you, Jade!


  1. You will. Just wait. ↩︎

  2. Archive link in case that’s down. ↩︎

  3. And if you don’t, learn. ↩︎

  4. Raycast command search snippets will list them. ↩︎

Yes to using text expanders! :clap: I only started using one fairly recently and I can’t imagine going back now.

For those looking for a cross-platform and/or open-source solution, I can highly recommend Espanso. It’s just one guy’s passion project but it works flawlessly.

Also, to follow up on your remark on tailoring the snippets to task at hand: It’s good to keep in mind that snippets don’t have to be universal nor permanent. Specialised one-off snippets can be very useful in certain scenarios. If the snippet saves you even a couple minutes of your time it’s already worth the extra effort.

Yes! I need to learn this. I resist creating new snippets which makes no sense.

Thanks for Espanso, looks great. FYI the reason I specifically went with Raycast is that we’re going to blow Jade’s mind by showing her the clipboard manager next… :upside_down_face:

1 Like

Oh boy, I’ll be waiting for this to learn something new!

Spot on! I’ve been using Autohotkey (windows) for text expansion for about a year now. It has a fairly advanced scripting feature if you want to go deeper. I use “dd” as my trigger for the date, and have also about 20 something expansions for common phrases, including standard email texts for follow up.

I’ve been using TextExpander for about a year now.

During the busy times of our seasonal business I can’t believe how much time this app has saved me. Literally hours per week, whether it’s a notice to customers that our latest shipment has arrived, or for a standard business signature.

I love the weekly reports I get, reminding me of how much time this little gem has saved me.

Can’t wait to test out this time snippet, cuz, yah, typing dates is a real pita I could do without!

For stuff like bank statements or other third-party pdf files you could go a step further and use Hazel to automate renaming the file.

I have Hazel monitoring my download folder. If a file fulfills certain criteria, it gets renamed. Hazel could even move the file to a specified place, if it’s always the same.

Hi Johnny,
thank you for this hint. It seems very valuable, except for the fact of data security. My Browser extension settings show the following:


Basically it says:
This extension can read and change websites as well as see your browser history on all websites. This includes confidential information from Websites, including passwords, phone numbers and credit card details.

What do you think about that?
Thanks for your feedback!
Gerald

Hi @geraldrh,

It’s a risk we all have to take every time we install software …
One of the other tools mentioned in this thread, expando, claims ‘privacy first’ in its title. I haven’t used either; in both cases it’s a matter of how do you decide what you trust?

Raycast is a for-profit company. Does that imply they have a reputation to uphold?

Expando’s creator has a picture of himself displayed prominently. Does that imply he has a reputation to uphold? Expando’s source code is open and it’s been starred 10,000+ times on Github. Does that imply that at least a few knowledgable people have audited it for security and privacy?

I don’t know … but at least there are choices. (personal opinion: the fact that Raycast Pro presents AI support as a feature implies to me that there might be use of your data going on beyond their direct control).

In the end, software needs permission to do useful things. Expando has a page about how certain features might not work on MacOS becaus MacOS has a particular security feature that sometimes blocks it: Secure Input on macOS | Espanso.

1 Like

I don’t use the browser extension, FWIW.

But yeah, generally if you give an app the ability to see your websites – which it needs if you want to, say, clip that website’s text to use it in the app – then that app needs to, well, read your websites! How else could it do what you’re asking it to do?

I generally assume that, like @hans says, a well-known app with a reputation to uphold is going to do the right thing. Because if it’s found out that Raycast is taking your website data for nefarious reasons, that’s a business-ending event for them. Why would they do that?

But as with all this stuff, you make your own decisions. It’s a risk/convenience trade-off.

1 Like

Here are a few good text expansion tools for Windows users:

  • aText – Not free, but affordable and also available for macOS.
  • Beeftext – Free and straightforward to use.
  • Espanso – already mentioned in the thread. Lightweight but has a steeper learning curve for writing snippets.
  • AutoHotKey’s built-in hotstrings – A powerful option if you’re already using AutoHotKey.

For anyone interested, I wrote a small AutoHotKey utility for inserting the date. Here’s how it works:

  • Ctrl+D inserts today’s date (e.g., 2024-11-27).
  • Double-tap Ctrl+D inserts the current month (e.g., 2024-11).
  • If the current file name is selected when pressing/double-tapping Ctrl+D, the date is prepended to the current file name.

Currently, it’s designed to work only in File Explorer (including Save as dialogs) and Directory Opus to avoid conflicts with other programs using the same key combo.

Here is the code, and if there’s interest, I can compile and share an .exe file. I’m also happy to try and adapt it to work in other tools if needed—just let me know.

#Requires AutoHotkey v2.0+
#SingleInstance Force

;;;; Inserts today's date in yyyy-MM-dd format when pressing Ctrl+D
;;;; Inserts today's date in yyyy-MM format when pressing Ctrl+D twice
global isPending := false
#HotIf WinActive("ahk_exe explorer.exe") || WinActive("ahk_class #32770") || WinActive("ahk_exe dopus.exe") ;Class #32770 is the class of the Save As windows
^d:: 
{ 
    global isPending
    if (isPending) { 
        ; Second press within 200ms 
        SetTimer(InsertDate, 0)  ; Cancel the pending timer
        SendInput "{Home}" A_YYYY "-" A_MM " "
        isPending := false
    } else { 
        ; First press, set up a timer
        isPending := true
        SetTimer(InsertDate, -200)  ; Negative value for a single execution after 200ms 
    } 
} 
 
InsertDate() 
{ 
    global isPending
    if (isPending) { 
        SendInput "{Home}" A_YYYY "-" A_MM "-" A_dd " "
        isPending := false 
    } 
} 
#HotIf

Another option is PhraseExpress. Windows and Mac.

Very flexible text expansion/replacement, plus clipboard manager. Free/Not terribly expensive, depending on your use case.

I use it at work to populate common paragraphs of information, insert dates, insert date/time, take multiple clipboard pieces and paste them into one field as a string in the order that I want (eg: copy text one two and then three; paste text three one two).

I have downloaded the app and looked over it briefly, rather scary, I am going to have a better look tomorrow or Friday, depending on what day my daughter goes back to school.

I recommend ;date; over ;;date because it allows snippets to overlap. For example:

;date;2024-11-27
;datetime;2024-11-27 04:39:25

If you did it the other way, then ;;date would expand before you could finish typing ;;datetime.

This also allows you to freely use very short snippets like ;d; without fear that they will conflict with longer ones.

Oooh this is a neat trick.

Alas my muscle-memory is seared in. I tried changing my shortcut the other week – because mine is ;;jpdate, the jp being for Japan. When I first learned about the date format I heard ‘it’s what the Japanese use’.

Utterly impossible to change! My brain just wouldn’t let me.

But if you’re just starting, this sounds like the way to go.