Jump to content

Get the weekday of a given date


Recommended Posts

This is a simple little workflow (which requires Alfred 5) to return the name of the weekday of any given date. The given date must be in the format dd/mm/yyyy (e.g., 28/08/2022) and there is some basic validation of user input (although I've no doubt the poor little thing will break if you kick it hard enough 😀). It relies on AppleScript at its core.

 

 

Get the weekday of a given date on Github.

Link to comment

I have a version of this workflow which is significantly extended and (I think!) improved. In particular:

  • The final output shows the input date in the format 25 December 2022 rather than 25/12/2022—which makes it easier to see if anything has gone horribly wrong. 😀
  • I think I may have made the workflow work with U.S. format dates (i.e., mm/dd/yyyy) but I need someone to test that for me. It needs to be someone whose system is set to U.S. format dates full time (I can experiment by a temporary change but really need someone to test it properly because I need to be sure some new AppleScript works with U.S. format date.) The U.S. format is a configuration option which you set when installing the workflow (by un-checking "Use European date format").

If anyone falls in the latter category and is interested in testing the new workflow please send me a direct message on here and I'll share the workflow with you.

 

Stephen

Link to comment

Fantastic work! Well presented with nice instructions and configuration. I’m glad you decided to share.


Tips:

  • For the Dialog Conditional, I’d consider Close instead of Ok. It’s more specific to the action that will happen. A fun idea would be Thank You!, which also indicates finality. If you stick with Ok, I recommend capitalising it: OK is usually how it appears in dialogs.
  • You might want to look next into releases (docs) instead of sharing directly in the repo. I know we call that “advanced” in the blog post, but your repos look good, I think you’re ready if you wish to go that route. Feel free to ping with questions.
  • Is there a particular reason why the Workflow “curves back” where it does? If you continue dragging an object to the right (or bottom) beyond what’s available, the canvas will expand. You can also use ⌘- ⌘+ and ⌘0 for zooming.

Extra tip for releases: Always upload the Workflow with the same file name and you can get an evergreen URL pointing to the latest stable (non-pre-release) version with the format:

 

https://github.com/USERNAME/REPO/releases/latest/download/WORKFLOW_FILE

 

Example:

 

https://github.com/Stephen-Lon/Alfred-workflow-get-weekday-of-date/releases/latest/download/Get.weekday.of.date.alfredworkflow

 

(When you upload a file to GitHub releases, it replaces spaces with dots. I say “let it”. Might as well embrace it than having to manually edit every time, which one might forget.

 

All of those are pretty minor and up to you. The way you’re doing it is already top notch!

Link to comment

Vitor:

 

Many thanks for the kind comments.

 

7 hours ago, vitor said:

For the Dialog Conditional, I’d consider Close instead of Ok.

Done, for the next minor update.

 

7 hours ago, vitor said:

You might want to look next into releases (docs) instead of sharing directly in the repo.

I need to study that to get to grips with it and will do so later today.

 

7 hours ago, vitor said:

Is there a particular reason why the Workflow “curves back” where it does?

It won't in the next minor release! That was just me working on a laptop screen (and never having written this long a workflow before!).

 

7 hours ago, vitor said:

Always upload the Workflow with the same file name

I suspect the issue may have arisen this time because I initially worked on a duplicate copy of the original workflow (so as not to mess up the original!) then deleted the original when this workflow clearly worked. I need to look at your pointer to "releases" on Github so there's a proper trail there.

 

Thanks again for the comments: much appreciated.

 

Stephen

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...