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