WolframAlpha - # of business days until a future date
Return the number of business days from now until a future date
The shortcut calculates the number of working days until a future date using the WolframAlpha API.
You'll first need to sign up for your own API key before installing the shortcut:
What's New
Version 1.0
First release
What it does
24 actions-
Text
-
CommentYou will need to sign up for your personal API key at https://products.wolframalpha.com/api/ Enter your API key below:
-
Text
-
Set Variableapi_key
-
Text
-
Set Variablejsonpath_query
-
Ask for InputWhat is the future date?
-
Format Date
-
Set Variabledate
-
Text
-
URL Encode
-
Text
-
Get Contents of URL
-
Get Text from Input
-
Set Variablejson_result
-
Text
-
Set Variablejsonpath_script
-
Text
-
Base64 Encode
-
URLdata:text/html;base64,…
-
Get Contents of Web Page
-
Get Text from Input
-
Set Variableresult
-
Show Result
View as code
Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.
#include 'actions/web'
#include 'actions/calendar'
#define color red
#define glyph calendar
/*
You will need to sign up for your personal API key at https://products.wolframalpha.com/api/
Enter your API key below:
*/
@api_key = "nil"
@jsonpath_query = "$..pods[?(@.scanner == 'Identity')].subpods[?(@.primary == true)].plaintext"
prompt("What is the future date?", "Date")
formatTimestamp("", "Long", "None")
@date = nil
urlEncode("")
downloadURL("")
getText(nil)
@json_result = nil
@jsonpath_script = "/* JSONPath 0.8.0 - XPath for JSON\n *\n * Copyright (c) 2007 Stefan Goessner (goessner.net)\n * Licensed under the MIT (MIT-LICENSE.txt) licence.\n */\nfunction jsonPath(obj, expr, arg) {\n var P = {\n resultType: arg && arg.resultType || \\"VALUE\\",\n result: [],\n normalize: function(expr) {\n var subx = [];\n return expr.replace(/[\['](\??\(.*?\))[\]']/g, function($0,$1){return \\"[#\\"+(subx.push($1)-1)+\\"]\\";})\n .replace(/'?\.'?|\['?/g, \\";\\")\n .replace(/;;;|;;/g, \\";..;\\")\n .replace(/;$|'?\]|'$/g, \\"\\")\n .replace(/#([0-9]+)/g, function($0,$1){return subx[$1];});\n },\n asPath: function(path) {\n var x = path.split(\\";\\"), p = \\"$\\";\n for (var i=1,n=x.length; i<n; i++)\n p += /^[0-9*]+$/.test(x[i]) ? (\\"[\\"+x[i]+\\"]\\") : (\\"['\\"+x[i]+\\"']\\");\n return p;\n },\n store: function(p, v) {\n if (p) P.result[P.result.length] = P.resultType == \\"PATH\\" ? P.asPath(p) : v;\n return !!p;\n },\n trace: function(expr, val, path) {\n if (expr) {\n var x = expr.split(\\";\\"), loc = x.shift();\n x = x.join(\\";\\");\n if (val && val.hasOwnProperty(loc))\n P.trace(x, val[loc], path + \\";\\" + loc);\n else if (loc === \\"*\\")\n P.walk(loc, x, val, path, function(m,l,x,v,p) { P.trace(m+\\";\\"+x,v,p); });\n else if (loc === \\"..\\") {\n P.trace(x, val, path);\n P.walk(loc, x, val, path, function(m,l,x,v,p) { typeof v[m] === \\"object\\" && P.trace(\\"..;\\"+x,v[m],p+\\";\\"+m); });\n }\n else if (/,/.test(loc)) { // [name1,name2,...]\n for (var s=loc.split(/'?,'?/),i=0,n=s.length; i<n; i++)\n P.trace(s[i]+\\";\\"+x, val, path);\n }\n else if (/^\(.*?\)$/.test(loc)) // [(expr)]\n P.trace(P.eval(loc, val, path.substr(path.lastIndexOf(\\";\\")+1))+\\";\\"+x, val, path);\n else if (/^\?\(.*?\)$/.test(loc)) // [?(expr)]\n P.walk(loc, x, val, path, function(m,l,x,v,p) { if (P.eval(l.replace(/^\?\((.*?)\)$/,\\"$1\\"),v[m],m)) P.trace(m+\\";\\"+x,v,p); });\n else if (/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(loc)) // [start:end:step] phyton slice syntax\n P.slice(loc, x, val, path);\n }\n else\n P.store(path, val);\n },\n walk: function(loc, expr, val, path, f) {\n if (val instanceof Array) {\n for (var i=0,n=val.length; i<n; i++)\n if (i in val)\n f(i,loc,expr,val,path);\n }\n else if (typeof val === \\"object\\") {\n for (var m in val)\n if (val.hasOwnProperty(m))\n f(m,loc,expr,val,path);\n }\n },\n slice: function(loc, expr, val, path) {\n if (val instanceof Array) {\n var len=val.length, start=0, end=len, step=1;\n loc.replace(/^(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)$/g, function($0,$1,$2,$3){start=parseInt($1||start);end=parseInt($2||end);step=parseInt($3||step);});\n start = (start < 0) ? Math.max(0,start+len) : Math.min(len,start);\n end = (end < 0) ? Math.max(0,end+len) : Math.min(len,end);\n for (var i=start; i<end; i+=step)\n P.trace(i+\\";\\"+expr, val, path);\n }\n },\n eval: function(x, _v, _vname) {\n try { return $ && _v && eval(x.replace(/@/g, \\"_v\\")); }\n catch(e) { throw new SyntaxError(\\"jsonPath: \\" + e.message + \\": \\" + x.replace(/@/g, \\"_v\\").replace(/\^/g, \\"_a\\")); }\n }\n };\n\n var $ = obj;\n if (expr && obj && (P.resultType == \\"VALUE\\" || P.resultType == \\"PATH\\")) {\n P.trace(P.normalize(expr).replace(/^\$;/,\\"\\"), obj, \\"$\\");\n return P.result.length ? P.result : false;\n }\n} "
base64Encode(nil)
url("data:text/html;base64,{}")
getWebpageContents("")
getText(nil)
@result = nil
show("There are {@result} until {@date}")
Open in Cherri Playground
Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.
Ratings & Reviews
Write a Review–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings
No reviews yet. Be the first to share what you think!
Advertisement
More by rasmus-lo
You Might Also Like
Advertisement