Calculation for after 16:30hrs
Hello, Can anyone help. I'm trying to workout the following calculation. If time is before 16:30hrs, on a working day, then display todays date. If time is after 16:30hrs on a working day, then display the next working day. (ie, if on a Friday, it would be Monday's date) If time is on a weekend, then display the next working day (ie Monday's date)   Anyone? :)

  • Jackpot. That is absolutely perfect and works flawlessly. Many thanks Rainer. I know JavaScript well, but I only code once a month at most, so it takes me a long time to work things out. You've just saved me an entire days worth of trial and error. :)
  • Hey Martin, yes, that's another case and it's possible with a calculation field:. This one should work: var date = @date field;var time = Number(moment(date).tz("Europe/Berlin").format("HHmm"));var weekday = moment(date).isoWeekday();var checkTime = time <= 1630 ? weekday : weekday + 1;checkTime < 6 ? moment(date).isoWeekday(checkTime).toDate() : moment(date).isoWeekday(8).toDate() It's important to add your timezone in var time (my timezone is "Europe/Berlin"). Should be the same timezone as in you Podio settings.  Rainer  
  • Hi Rainer, I do have Globiflow, but I was hoping to do it all in a calculation field. It's not using the today date. I'll be updating a date field with a specific date. So I'll be a selecting a "time I visited the address", for example Thursday 23rd August 2018 at 17:00hrs. And then I need a calculation box to work out if the date is after 16:30hrs, or before, and if it is before, update the calculation field to 23/08/2018, or if it is after 16:30hrs, then update the calculation field to 24/08/18. The second issue is, if that falls on a saturday or sunday, then it needs to be updated to the Monday date. It's a simple requirement, but when you look closely, it's actually quite a complex calculation and way over my knowledge, so I've been doing trial and error. I've got so far to being able to put in the following days date using the calculation field, but not yet able to account for a saturday or sunday.
  • Hi Martyn, that's a nice one. :)  The change of what's displayed in a calculation field must be triggered by a change of a variable in the code. But Podio calculation fields have no build-in variable for "today" and for time. So you need to create your own variable - and a trigger which changes the value of the variable. I've described in some comments in this forum how to create the own variable for today, it's the same procedure for the time. You need to use Globiflow for that (which is included in the Podio Premium Licence). So before I explain what to do I need to know if you have access to Globiflow (if not, you need to write a script to call the Podio API to achieve it; without Globiflow or Script it's not possible).Rainer 
This question is closed.