Bug: Weekday of Document Date is off by one day and crashes for Sundays

Just starting out with smart rules and scripting … and already encountered a curious bug:

I have a smart rule for renaming pdfs created from screenshots that contain a date. The smart rule action Change Name contains the placeholders Sortable Document Date and Weekday of Document Date.

Applying the rule to pdfs with various dates in the document results in filenames with a correct sortable date and a wrong weekday that is off by one day: e.g. instead of ‘2022-12-06 Tuesday’, it is ‘2022-12-06 Monday’.

Even worse: if the document contains a date of a Sunday, then DEVONthink crashes without changing the name.

Just in case, I tested changing the system setting for First Day of Week from Monday to Sunday, but that does not seem to have an effect on the issue.

Please choose Help > Report Bug while pressing the Alt modifier key and send the result to cgrunenberg - at - devon-technologies.com including an example document/screenshot - thanks!

Why do you have mixed locales for your weekdays, i.e. they’re German at the bottom of your screenshot but English on top? Put differently: It seems that DT is running in an English locale, whereas other software on the same Mac run in a German one.

sent the crash logs

My system is set to English because most all support information on the Internet is in English and it’s much easier for me if menu commands and such are the same.
I just tried to change DEVONthink’s interface language to German, but couldn’t find an option - maybe it always uses the system language?

Actually, it didn’t even occur to me to expect a German output for the Weekday function :blush:. Maybe someone with a German system could test this? I’d rather not change mine.

The example above was a pdf created from a screenshot of a German webpage. This does not seem to be a problem for the scan text action.

I also tested my smart rule with a minimal pdf containing just an English format date and it crashed too.

It does, as does (or should do) every other app on your Mac.

Which seems to indicate that the issue is not related to locale settings.

What operating system are you running?

The most recent - Ventura 13.0.1

Exactly.
My guess is this could be an issue with a zero- vs. one-based array for the names of the days. So, if some code assumes that day[0]=“Sunday”, day[1]=“Monday” and so on, when in fact day[1]=“Sunday”, day[2]=“Monday” etc., while day[0] is undefined - that would explain the day’s name being off by one or crashing when trying to access day[0]
Of course, there shouldn’t be a crash but a graceful exit with an error message …

It’s a little bit more complicated but the next release will fix this.

That’s great to hear! Thank you