Here is a JS to expand the current year as Roman Numerals. I use the abbreviation “cyroman”. Is there a better way to share these here?
var num = new Date().getFullYear();
var roman = {M:1000, CM:900, D:500, CD:400, C:100, XC:90, L:50, XL:40, X:10, IX:9, V:5, IV:4, I:1};
var str = "";
for (var i of Object.keys(roman)) {
while (num >= roman[i]) { str += i; num -= roman[i]; }
}
str;
1 Like
Thanks, this is great! I’ve added it to the Community Snippets Public Group with the abbreviation com.roman
. We’re working on a better way to share Snippets. Stay tuned!
1 Like
This is really cool! I’d love to try it out, but I’ve honestly never scripted anything before—any chance someone could walk me through how I might use this?
1 Like
The easy solution is to subscribe to the Public Group I linked to above, but here’s a video showing how to load a script into TextExpander: