Date formats for an email subject line

I have a shortcut that takes the last 2 images in an album and emails it to a recipient using a date formatted like 9/6 (“single” dates) or 9/10 (“double”).

Reading through parts of the Unicode 35 spec, I don’t see this format in any of the examples. E.g, While “slash” may be \u002F, nothing I see in the tables puts them together, which is odd.

Does anyone have a better resource for this kind of thing?

I’m not sure what you are asking for exactly, but you can output in custom formats if that is what you are looking for?

There is a reference in section 9 of the spec to using characters such as a forward slash in dates and the use of “lenient parsing”. Slashes tend to be used in localisation, but while I have seen “day/month” used as shorthand, I have never seen it as a standard localisation. Being UK-based, we might drop the year for shorthand as noted, but a I’ve never seen “month/day”, which I am assuming is the referenced format given today is 6 September.

In terms of using custom date formats, you can use separators or build the date using elements and separators applied outside the magic variable formatting → here is an example to illustrate.

https://www.icloud.com/shortcuts/2e986f7b8be74352898006976a4fc7fd

This is what I use in my date picker shortcut

M/d EEE
yyyy-MM-dd@HH-mm-ss
yyyy-MM-dd@HH-mm-ss EEEE, MMM, d, yyyy
EEEE, d MMMM yyyy ‘at’ HH:mm’hrs’
EEE, d MMM yy ‘at’ HH:mm’hrs’
EEE, dd/MM/yy ‘at’ HH:mm’hrs’
yyyy-MM-dd-HHmm
yyyy-MM-dd-HHmmss

What tokens are you using?

Using the examples I mentioned, passing the token M:dd appears to work. This still leaves me with the task of formatting the message.

For this part, I typically will compose a message of the form:

Start: {{ StartingPhoto }}

End: {{ EndingPhoto }}

This is functional now and WIP shots are below - the date seems like it displays correctly, but I am still unsure how to insert the images in the corresponding locations.

(Thinking about it more, I suspect each photo might need to be its own variable…)

Not displayed is the last step - “Open URLs” with a specific value passed in.

Using that format gives you a result like this:

This differs from what you were after in two ways.

  1. The separator is a colon rather than a forward slash.
  2. The day part includes a leading zero to pad to two digits, whereas your original did not.

For what it’s worth, the examples in the shortcut I posted earlier address both of these points and give an exact match to your original request. The two options for formatting the date it presents include one option that is probably within spec. as per the reference I noted for section 9 of the Unicode spec, and one that is guaranteed in spec as it moves the use of the separator outside of the formatting routine and into the shortcut.

In terms of adding photos to an e-mail, in the most basic terms, you just need to pass them in to the mail action.

Here’s an example run.

Note that the images are in effect appended to the mail. This isn’t due to the location of the magic variable to include the photos - you can try swapping the order of the two message content variables and the result will be the same. This is because the images are being added as attachments. Note also from the action’s documentation that the action will accept text and anything else is then added as an attachment - it is the designed behaviour.

If you wanted to automate working with inline image placement in an e-mail (as implied by your message form text above), you would need to investigate the option to automate doing so in other e-mail client apps.

In the past I’ve seen this done by users uploading images, getting download URLs and including them in an HTML formatted e-mail - but that’s been using things like the Drafts Mail Assistant on the Mac. I’ve never had a need to investigate further on this myself.

While you can build rich text from HTML (or Markdown) that could include inline elements such as images, you’ll note that if you attempt this with Mail, because it does not recognise Rich Text as an input, but it does recognise text, it picks out the text when it gets picked up by the mail app, and that the text is the raw HTML.

I hope that helps/clarifies things for you.

1 Like

I ended up changing the date format to make this work. Using Short and setting the Time parameter to none is probably close enough and doesn’t have the exceptional case I was trying to work around.

I have collected a few other Shortcuts which deal with the question of inline placement. I’ll investigate to see if they are needed here - some servers will flag as spam any emails which only contain attachments and nothing in the message body.