vfade Posted December 28, 2021 Share Posted December 28, 2021 * Using this dynamic placeholder: {date:YYYY-MM-dd}, I expect "2021-12-28", but instead get "2022-12-28". * Whether you were able to replicate it a second time by performing the same action: Yes * Include any screenshots that might help us: Attached * Include the Alfred version & build number: 4.6.1 [1271] * Include your macOS version: 12.1 Link to comment Share on other sites More sharing options...
vfade Posted December 28, 2021 Author Share Posted December 28, 2021 I have tried using "Large Type" and "Arg and Vars" and am seeing the same behavior. Link to comment Share on other sites More sharing options...
Andrew Posted December 28, 2021 Share Posted December 28, 2021 @vfade you need to use yyyy for the year placeholder, as YYYY is for Year in "Week of Year" based calendars. http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns vfade 1 Link to comment Share on other sites More sharing options...
vfade Posted December 28, 2021 Author Share Posted December 28, 2021 Awesome -- thanks @Andrew! Link to comment Share on other sites More sharing options...
deanishe Posted December 29, 2021 Share Posted December 29, 2021 20 hours ago, Andrew said: as YYYY is for Year in "Week of Year" based calendars. Huh. By my reckoning, YYYY should still be 2021. First week of 2022 is next week (first Thursday of the year). Link to comment Share on other sites More sharing options...
Andrew Posted December 29, 2021 Share Posted December 29, 2021 5 hours ago, deanishe said: Huh. By my reckoning, YYYY should still be 2021. First week of 2022 is next week (first Thursday of the year). I'm just quoting what they say on the unicode.org site (link above), and it's the same answer I give for a fix at the end of December every year... so... *shrugs*? Link to comment Share on other sites More sharing options...
deanishe Posted December 29, 2021 Share Posted December 29, 2021 (edited) 6 hours ago, Andrew said: I'm just quoting what they say on the unicode.org site (link above), and it's the same answer I give for a fix at the end of December every year... so... *shrugs*? Oh no, what you said is 100% correct. But Germans love Week of Year for some reason, so it's printed on every calendar, and this week is 100% week 52 of 2021, not week 1 of 2022. YYYY should be 2021 before Monday 3 January. I just ran the same snippet placeholder ({date:YYYY-MM-dd}) on my machine, and I get 2021-12-30. So something funny is going on with @vfade's Mac all the same. What do you get on your machine, @Andrew? @vfade Could you check your OS date & time settings? If everything's okay, what locale/region settings do you have? Edited December 29, 2021 by deanishe Link to comment Share on other sites More sharing options...
iApple Posted December 30, 2021 Share Posted December 30, 2021 (edited) Riding on this, I couldn’t find syntax for start of week to get something like “week of January 2” for start of next week. Edited December 30, 2021 by iApple Link to comment Share on other sites More sharing options...
Andrew Posted December 30, 2021 Share Posted December 30, 2021 @deanishe huh, you're correct - Right this moment, I get 2021 for both yyyy and YYYY. Link to comment Share on other sites More sharing options...
deanishe Posted December 30, 2021 Share Posted December 30, 2021 9 hours ago, iApple said: I couldn’t find syntax for start of week to get something like “week of January 2” for start of next week. I think there's only "week of year". If you want to find the first day of that week, you'll need to do that programmatically by the looks of it. It probably wouldn't work for you, anyway, because ISO weeks start on a Monday, so next week would be "week of 3 January", not 2. Link to comment Share on other sites More sharing options...
iApple Posted December 30, 2021 Share Posted December 30, 2021 14 minutes ago, deanishe said: I think there's only "week of year". If you want to find the first day of that week, you'll need to do that programmatically by the looks of it. It probably wouldn't work for you, anyway, because ISO weeks start on a Monday, so next week would be "week of 3 January", not 2. Actually Monday start works for me. Was using Sunday as an example I need to google for a programmatic solution. Was hoping there's a start of week in Andrew's link. Link to comment Share on other sites More sharing options...
deanishe Posted December 30, 2021 Share Posted December 30, 2021 (edited) 13 minutes ago, iApple said: I need to google for a programmatic solution In Python 3: from datetime import datetime, timedelta # date to find week for in format YYYY-MM-DD input_date = '2022-01-06' dt = datetime.strptime(input_date, '%Y-%m-%d') while dt.weekday(): # 0 = Monday dt -= timedelta(days=1) formatted = 'week of ' + dt.strftime('%d %B').lstrip('0') print(f'{input_date} -> week of {formatted}') Edited December 30, 2021 by deanishe Link to comment Share on other sites More sharing options...
iApple Posted December 31, 2021 Share Posted December 31, 2021 14 hours ago, deanishe said: In Python 3: from datetime import datetime, timedelta # date to find week for in format YYYY-MM-DD input_date = '2022-01-06' dt = datetime.strptime(input_date, '%Y-%m-%d') while dt.weekday(): # 0 = Monday dt -= timedelta(days=1) formatted = 'week of ' + dt.strftime('%d %B').lstrip('0') print(f'{input_date} -> week of {formatted}') Thanks! Had to google python, took a long while just to learn basics of AppleScript. I’m really a technically challenged individual 😅 Link to comment Share on other sites More sharing options...
vitor Posted December 31, 2021 Share Posted December 31, 2021 11 hours ago, iApple said: took a long while just to learn basics of AppleScript. I’m really a technically challenged individual AppleScript is a subpar, atypical, underdocumented language with a small community. Taking long to learn it in no way reflects your ability to learn to program. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now