1

I made a script in appmaker that takes the date inserted in Google sheet and displayed in appmaker. The date is prior by one day.If I insert in Google sheet 10-08-2018 it gets in appmaker 2018-10-07 I don't know why?!

Here is the code in appmaker:

function getCellValue(spreadsheetId, sheetName, cellRange) {
  var range = getRange_(spreadsheetId, sheetName, cellRange);

  return JSON.stringify(range.getValue());
}

function createAutoTickets(widget) {
var jsonResultDATE = getCellValue(sheet.sheet_id, getSheets(sheet.sheet_id), 'B' + ii.toString());
var newRecord = app.models.AymanTickets.newRecord();
            console.info(jsonResultDATE.substr(1, 10));
            newRecord.ticket_date = new Date(jsonResultDATE.substr(1, 10));
 app.saveRecords([newRecord]); 
}

And the whole script code https://docs.google.com/document/d/1jMTHIzK7nIVR2kgBpmwFdYVitnV-8p8Njm9RT6TGHyE/edit?usp=sharing

  • In an attempt to figure out what’s going on can you format the date field in app maker to include hours and minutes so you can determine if the date is different exactly by 24 hours or if it happens to be some other amount? – Markus Malessa Dec 11 '19 at 13:06
  • yes,It is postponed by 24 hours. It's weird – AbdelRahman Zaki Dec 11 '19 at 15:00
  • I made the both the same date format at GMT+2 but nothing changed. When I changed them to date and time format,it is prior by 24 hours. – AbdelRahman Zaki Dec 12 '19 at 13:16

0 Answers0