From c3f6bebe2b138d929fe8d1f2bcb02f0b6755fc41 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 8 Aug 2016 20:01:22 -0400 Subject: [PATCH] bugfix Date -> new Date --- lib/cert-info.js | 4 ++-- tests/cert-info.js | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 tests/cert-info.js diff --git a/lib/cert-info.js b/lib/cert-info.js index b7bc669..394b7bf 100644 --- a/lib/cert-info.js +++ b/lib/cert-info.js @@ -51,12 +51,12 @@ if (require.main === module) { console.info(''); console.info(c.notBefore.value); - console.info(Date(c.notBefore.value).valueOf()); + console.info(new Date(c.notBefore.value).valueOf()); console.info(''); console.info(c.notAfter.value); - console.info(Date(c.notAfter.value).valueOf()); + console.info(new Date(c.notAfter.value).valueOf()); console.info(''); } diff --git a/tests/cert-info.js b/tests/cert-info.js new file mode 100644 index 0000000..525ce94 --- /dev/null +++ b/tests/cert-info.js @@ -0,0 +1,21 @@ +'use strict'; + +var certInfo = require('../lib/cert-info.js'); + +var c = certInfo.testGetCertInfo(); + +console.info(''); + +console.info(c.notBefore.value); +console.info(new Date(c.notBefore.value).valueOf()); + +console.info(''); + +console.info(c.notAfter.value); +console.info(new Date(c.notAfter.value).valueOf()); + +console.info(''); + +console.info(''); +console.info('If we got values at all, it must have passed.'); +console.info('');