middlebrun Posted May 26, 2021 Share Posted May 26, 2021 I often need to calculate a person’s age based on their date of birth for medical documentation. Ideally, the output would appear as “8-year, 3-month-old” as I have a pediatrics practice. Is there a workflow in Alfred for this? If not, can TextExpander or another app perform this quickly? Thanks! Sean Link to comment
giovanni Posted May 26, 2021 Share Posted May 26, 2021 welcome to the forum @middlebrun! What would be your preferred format to entry the date of birth? Link to comment
middlebrun Posted May 26, 2021 Author Share Posted May 26, 2021 YYYY-Mon-DD 2021–May-26 Thanks! Link to comment
giovanni Posted May 26, 2021 Share Posted May 26, 2021 this should work with your format, keyword: 'age'. hope this helps middlebrun 1 Link to comment
middlebrun Posted May 27, 2021 Author Share Posted May 27, 2021 @giovanni Thanks! It works great. Much appreciated Is it easy to alter so that only the year and month appear? Including the date is too granular for my purposes. I guess I better learn to code... Sean Link to comment
giovanni Posted May 27, 2021 Share Posted May 27, 2021 1 minute ago, middlebrun said: only the year and month appear? you mean entering year and month only? like: `2003-Dec`? Link to comment
middlebrun Posted May 27, 2021 Author Share Posted May 27, 2021 Sorry for the lack of clarity. I'd still like to enter the full date of birth (as "2003-Dec-16") but generate to the clipboard only the year and month (as "10y 1m"). Thanks again for your kind help! Sean Link to comment
deanishe Posted May 27, 2021 Share Posted May 27, 2021 8 minutes ago, middlebrun said: I'd still like to enter the full date of birth (as "2003-Dec-16") Enter or paste? That's a lot to type, and pasting is a waste of time when you could just select the date in another app and hit a hotkey. Link to comment
giovanni Posted May 27, 2021 Share Posted May 27, 2021 delete these lines below from the python script, or use this version if Days > 0: finalString = finalString + str(Days) + 'd ' yes, as @deanishe says if you are able to select the date you might want to apply the script to the clipboard content and launch it with a hotkey Link to comment
deanishe Posted May 27, 2021 Share Posted May 27, 2021 Just now, giovanni said: apply the script to the clipboard content and launch it with a hotkey Hotkeys can use the current selection as input, so you don't necessarily need to copy anything. giovanni 1 Link to comment
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