Skip to content

Commit 1b7569b

Browse files
committed
include offset in last_modified_time
1 parent 0266d65 commit 1b7569b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

components/zoho_books/sources/new-or-updated-invoice/new-or-updated-invoice.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ export default {
3434
}
3535
const date = new Date(ts);
3636
const pad = (n) => n.toString().padStart(2, "0");
37-
const formattedUTC = `${date.getUTCFullYear()}-${pad(date.getUTCMonth() + 1)}-${pad(date.getUTCDate())}T${pad(date.getUTCHours())}:${pad(date.getUTCMinutes())}:${pad(date.getUTCSeconds())}`;
38-
return formattedUTC;
37+
const formatted = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
38+
39+
const offsetMinutes = date.getTimezoneOffset();
40+
const sign = offsetMinutes > 0
41+
? "-"
42+
: "+";
43+
const absOffset = Math.abs(offsetMinutes);
44+
const offsetHours = pad(Math.floor(absOffset / 60));
45+
const offsetMins = pad(absOffset % 60);
46+
47+
return `${formatted}${sign}${offsetHours}${offsetMins}`;
3948
},
4049
getItemId(item) {
4150
return `${item.invoice_id}${Date.parse(item[this.getTsField()])}`;

0 commit comments

Comments
 (0)