diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-06-11 22:47:41 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-06-11 22:47:41 +0200 |
commit | 99ec25bbb6f410ae33f09ee75ae005f5ffcdffcf (patch) | |
tree | 6323ba1ad05d7addf115dd5f6148e625b690ef59 | |
parent | be8d25968bfa511aa856759f6fbe9dfa5c8248f6 (diff) |
Update the docs which incorrectly had a 1-indexed month
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | south-african-id-parser.js | 7 |
2 files changed, 7 insertions, 4 deletions
@@ -59,7 +59,7 @@ var validIdNumber = '9001049818080'; var info = saIdParser.parse(validIdNumber); // info === { // isValid: true, -// dateOfBirth: new Date(1990, 01, 04), +// dateOfBirth: new Date(1990, 0, 4), // isMale: true, // isFemale: false, // isSouthAfricanCitizen: true @@ -95,7 +95,7 @@ var saIdParser = require('south-african-id-parser'); var validIdNumber = '9001049818080'; var dateOfBirth = saIdParser.parseDateOfBirth(validIdNumber); -// dateOfBirth === new Date(1990, 01, 04) +// dateOfBirth === new Date(1990, 0, 4) ``` The date of birth included in the ID number has a two digit year. For diff --git a/south-african-id-parser.js b/south-african-id-parser.js index 62f5e15..983647a 100644 --- a/south-african-id-parser.js +++ b/south-african-id-parser.js @@ -52,7 +52,7 @@ * var info = saIdParser.parse(validIdNumber); * // info === { * // isValid: true, - * // dateOfBirth: new Date(1990, 01, 04), + * // dateOfBirth: new Date(1990, 0, 4), * // isMale: true, * // isFemale: false, * // isSouthAfricanCitizen: true @@ -103,6 +103,9 @@ * December 2015. If, on the other hand, the date of birth is parsed as 11 * December 15, that will be interpreted as 10 December 1915. * + * The date will be in the local timezone, with the time portion set to + * midnight. + * * @function * @param {string} idNumber - The ID number to be parsed. * @return {?Date} The date of birth from the ID number, or undefined if the @@ -114,7 +117,7 @@ * var validIdNumber = '9001049818080'; * var dateOfBirth = saIdParser.parseDateOfBirth(validIdNumber); * - * // dateOfBirth === new Date(1990, 01, 04) + * // dateOfBirth === new Date(1990, 0, 4) */ parseDateOfBirth: parseDateOfBirth, |