From c836999b0d0e30361b4af71621e14c96d424a834 Mon Sep 17 00:00:00 2001 From: Pete Morgan Date: Sat, 28 Apr 2018 10:33:10 +0100 Subject: [PATCH 1/2] Note re js quirk of zero based month --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b970c4c..71a6683 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,9 @@ exports.selectDate = function() { theme: "light", maxDate: new Date() }).then((result) => { + // Note the month is 1-12 (unlike js which is 0-11) console.log("Date is: " + result.day + "-" + result.month + "-" + result.year); + var jsdate = new Date(result.year, result.month + 1, result.day); }).catch((error) => { console.log("Error: " + error); }); @@ -82,7 +84,7 @@ exports.selectTime = function() { `pickDate(options): Promise<{}>;` -Returns a promise that resolves to date object +Returns a promise that resolves to date object (Note: the month is 1-12, unlike js which is 0-11) ```js date: { day: number, From 31d290f648aa05e0829c6a7a69d867f1ecdac179 Mon Sep 17 00:00:00 2001 From: Pete Morgan Date: Sat, 28 Apr 2018 11:21:40 +0100 Subject: [PATCH 2/2] doh! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71a6683..f5e5c19 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ exports.selectDate = function() { }).then((result) => { // Note the month is 1-12 (unlike js which is 0-11) console.log("Date is: " + result.day + "-" + result.month + "-" + result.year); - var jsdate = new Date(result.year, result.month + 1, result.day); + var jsdate = new Date(result.year, result.month - 1, result.day); }).catch((error) => { console.log("Error: " + error); });