From a138407c6a7df3b2b6640750c04bd01a640b383d Mon Sep 17 00:00:00 2001 From: Gurjeet Singh Date: Sat, 3 Nov 2012 08:38:56 -0400 Subject: [PATCH] Use JS Date's getFullYear() in first example. In year 2012, seeing the output of 112 confused me, and would potentially confuse any JS noob. I thought it was some bug in node-postgres. Presumably, JS starts counting time from Jan 1, 1900! Also, according to [1], getYear() is deprecated and one should use getFullYear() instead. [1] http://www.w3schools.com/jsref/jsref_obj_date.asp --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3123fa9..4bff7fa6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ var conString = "tcp://postgres:1234@localhost/postgres"; pg.connect(conString, function(err, client) { client.query("SELECT NOW() as when", function(err, result) { console.log("Row count: %d",result.rows.length); // 1 - console.log("Current year: %d", result.rows[0].when.getYear()); + console.log("Current year: %d", result.rows[0].when.getFullYear()); }); }); ```