Hi I need to fill in the date onto a website but it only accepts input in this format (Example: 4 Dec 2021). I have no problem generating the date on ui.vision but it returns everything in numeric (4 - 12 - 2021). How do I convert 12 to December? and same goes for the other months from 1 -11. Thanks!
Convert a number to month name can be done with Javascript, which you can run inside executescript_sandbox.
This works:
{
"Name": "MonthName",
"CreationDate": "2021-12-8",
"Commands": [
{
"Command": "store",
"Target": "12",
"Value": "m",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "var months = [ \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \n \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ];\n\nvar selectedMonthName = months[${m}-1]; return selectedMonthName;",
"Value": "m2",
"Description": "we use m-1 because arrays start at 0"
},
{
"Command": "echo",
"Target": "The month is ${m2}",
"Value": "green",
"Description": ""
}
]
}
2 Likes
Thank you so much for the fast reply! I’ve tried and it works