diff --git a/lib/index.js b/lib/index.js index 861b6b2..0439a15 100644 --- a/lib/index.js +++ b/lib/index.js @@ -3231,12 +3231,29 @@ var Modules = (function (modules) { parts = dateString.match( /(\d\d\d\d)?-?(\d\d)?-?(\d\d)?/ ); if(parts[1]) { this.dY = parts[1]; - } - if(parts[2]) { - this.dM = parts[2]; - } - if(parts[3]) { - this.dD = parts[3]; + if(parts[2]) { + this.dM = parts[2]; + } + if(parts[3]) { + this.dD = parts[3]; + } + } else { + // --MM-DD + parts = dateString.match( /(\d\d)-(\d\d)/ ); + if(parts[1]) { + this.dM = parts[1]; + } + if(parts[2]) { + this.dD = parts[2]; + } + var _d = new Date(['9999',this.dM,this.dD].join('-')); + var _now = new Date(); + var _y = _now.getFullYear(); + if (_d.getMonth() === _now.getMonth()) { + this.dY = (_d.getDate() < _now.getDate()-1) ? (_y+1) : _y; + } else { + this.dY = (_d.getMonth() < _now.getMonth()) ? (_y+1) : _y; + } } } return this.toString(this.format); @@ -4602,4 +4619,4 @@ module.exports = { countAsync: Modules.countAsync, isMicroformatAsync: Modules.isMicroformatAsync, hasMicroformatsAsync: Modules.hasMicroformatsAsync -} \ No newline at end of file +}