0

I am trying to set up a filter in integromat where i am putting the condition like this;

condition google calender free/busy- Time Min. is equal to dialogflow date_time.

Problem is date/time format from google calender is like :- April 2, 2021 3:00 PM and date/time format of dialogflow is like 2021-04-02T15:00:00+5:30.

so my condition is not fullfilling. i want both the date/time format to be same. How can i do this in integromat.??

enter image description here

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • 1
    Please edit your question and include [example] i dont think thats the standard format that Calendar api returns. – Linda Lawton - DaImTo Apr 02 '21 at 11:55
  • The [formatting tokens for formatDate and ParseDate](https://support.integromat.com/hc/en-us/articles/360005772013-Tokens-for-date-time-formatting) allow you to define custom date formats in Integromat. – Perette Apr 02 '21 at 19:23

1 Answers1

0

I think you need to have a webhook and over the webhook compare the two dates. You can convert the date coming from Dialogflow to your desired format with this code.

// Get date-time string for calender
const dateTimeForCalander = (date, time) => {

    let year = date.split('T')[0].split('-')[0];
    let month = date.split('T')[0].split('-')[1];
    let day = date.split('T')[0].split('-')[2];

    let hour = time.split('T')[1].split(':')[0];
    let minute = time.split('T')[1].split(':')[1];

    let newDateTime = `${year}-${month}-${day}T${hour}:${minute}:00.000${TIMEOFFSET}`;

    let event = new Date(Date.parse(newDateTime));

    let startDate = event;
    let endDate = new Date(new Date(startDate).setHours(startDate.getHours()+1));

    return {
        'start': startDate,
        'end': endDate
    }
};
Prisoner
  • 49,922
  • 7
  • 53
  • 105
Raj
  • 51
  • 1
  • 6