Skip to content

Commit 5c23389

Browse files
committed
Add failing early date tests
1 parent b38d60d commit 5c23389

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/integration/client/type-coercion-tests.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,25 @@ test("timestampz round trip", function() {
150150
client.on('drain', client.end.bind(client));
151151
});
152152

153+
test('early AD date', function() {
154+
var client = helper.client();
155+
client.on('error', function(err) {
156+
console.log(err);
157+
client.end();
158+
});
159+
160+
client.query('SELECT $1::TIMESTAMPTZ as when', ["0062-03-08 14:32:00"], assert.success(function(res) {
161+
assert.equal(res.rows[0].when.getFullYear(), 62);
162+
}))
163+
164+
client.query('SELECT $1::TIMESTAMPTZ as when', ["0062-03-08 14:32:00 BC"], assert.success(function(res) {
165+
console.log(res.rows[0].when)
166+
assert.equal(res.rows[0].when.getFullYear(), 62);
167+
}))
168+
169+
client.on('drain', client.end.bind(client));
170+
})
171+
153172
helper.pg.connect(helper.config, assert.calls(function(err, client, done) {
154173
assert.isNull(err);
155174
client.query('select null as res;', assert.calls(function(err, res) {

0 commit comments

Comments
 (0)