Untitled
unknown
javascript
4 years ago
1.3 kB
8
Indexable
//NOWY KOD TESTOWY DUZY v4
//const hubspot = require('@hubspot/api-client');
exports.main = async (event, callback) => {
// const deal_stage_ongoing___time = new Date(); //Zamienic ta wartosc na pobierana z properties
// Miesiac startowy
const deal_time_start = event.inputFields['deal_stage_ongoing___time'];
let dateStart = new Date(parseInt(deal_time_start));
let dateStartDay = dateStart.getDate();
let dateStartMonth = dateStart.getMonth();
// Wartosci sprawdzanego dnia na teraz
let currentDateDay = new Date().getDate();
let currentDateMonth = (new Date().getMonth()+1);
let output = '';
console.log("Miesiac start : = "+ dateStartDay + ". Miesiac sprawdzany: = "+currentDateMonth);
if( (dateStartMonth + 1) === currentDateMonth && dateStartDay === currentDateDay) {
console.log("Dziala");
console.log("Czas startowy: " + dateStart);
console.log("Czas teraz: Miesiac " + currentDateMonth);
console.log("Czas teraz: Dzien " + currentDateDay);
output = 'True';
}
else
{
console.log("Nie Dziala");
console.log("Czas startowy: " + dateStart);
console.log("Czas teraz: Miesiac " + currentDateMonth);
console.log("Czas teraz: Dzien " + currentDateDay);
output = 'False';
}
callback({
outputFields: {
output: output
}
})
}Editor is loading...