| Conditions | 1 |
| Paths | 2 |
| Total Lines | 44 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 4 | module.exports = function(GedcomX){ |
||
| 5 | |||
| 6 | // Extend serialization properties |
||
| 7 | GedcomX.Date.jsonProps.push('normalized'); |
||
| 8 | |||
| 9 | // Override init() so that we can deserialize normalized values |
||
| 10 | var oldInit = GedcomX.Date.prototype.init; |
||
| 11 | GedcomX.Date.prototype.init = function(json){ |
||
| 12 | oldInit.call(this, json); |
||
| 13 | if(json){ |
||
| 14 | this.setNormalized(json.normalized); |
||
| 15 | } |
||
| 16 | }; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Set the normalized values |
||
| 20 | * |
||
| 21 | * @param {TextValue[]} normalized |
||
| 22 | * @return {Date} this |
||
| 23 | */ |
||
| 24 | GedcomX.Date.prototype.setNormalized = function(normalized){ |
||
| 25 | return this._setArray(normalized, 'normalized', 'addNormalized'); |
||
| 26 | }; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Add a normalized value |
||
| 30 | * |
||
| 31 | * @param {TextValue} normalized |
||
| 32 | * @return {Date} this |
||
| 33 | */ |
||
| 34 | GedcomX.Date.prototype.addNormalized = function(normalized){ |
||
| 35 | return this._arrayPush(normalized, 'normalized', GedcomX.TextValue); |
||
| 36 | }; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Get the normalized values |
||
| 40 | * |
||
| 41 | * @return {TextValue[]} |
||
| 42 | */ |
||
| 43 | GedcomX.Date.prototype.getNormalized = function(){ |
||
| 44 | return this.normalized || []; |
||
| 45 | }; |
||
| 46 | |||
| 47 | }; |