aj11
1
I’m looking for someone to build a simple plugin that adds a backend workflow action that has the following functionality:
A condition field.
If condition field is “yes”, pass date 1 through to following steps.
If condition field is “no”, pass date 2 through to the following steps.
The date fields need to be dynamic.
Can anyone build this? Please PM me a quote.
1 Like
Hi @aj11 !
Do you have a reason why you need a plugin for this?
This seams to be doable without one…
aj11
3
Yes, if you convert to Unix and just use the text, but then you also have to convert back to a date. Many points of failure.
I can develop this plugin later today
1 Like
Don’t know
…
I think you can use javascript to do it. It is quite simple…
You can use javascript to convert to UNIX:
const dateStr = '2022-08-17 12:00:00';
const date = new Date(dateStr);
const timestampInMs = date.getTime();
const timestampInSeconds = Math.floor(date.getTime() / 1000);
alert (timestampInSeconds);
And use javascript to convert it back:
let unix_timestamp = "1660748400";
var date2 = new Date(unix_timestamp * 1000);
var hours = date2.getHours();
var minutes = "0" + date2.getMinutes();
var seconds = "0" + date2.getSeconds();
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
alert (date2);
Did you already tried?
You can test the code here:
https://www.webtoolkitonline.com/javascript-tester.html
Also found some plugins for it…
aj11
7
The number and complexity of the date system I’m working on makes this solution impractical.
aj11
8
Shout out to @razaadeel8 for the help on this. He quickly built a great little plugin.
2 Likes