From 2279b74b3957e4b0eeeb5890d6eae54681d562dd Mon Sep 17 00:00:00 2001 From: Arash Mousavi Date: Sun, 25 Aug 2019 00:42:23 +0100 Subject: [PATCH] Adds support for passing integer numbers --- README.md | 9 +++++---- lib/jdate.js | 27 ++++++++++++++++++--------- lib/jdate.min.js | 4 ++-- src/jdate.js | 21 +++++++++++++++------ tests/jdate.test.js | 11 +++++++++++ 5 files changed, 51 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 90a7d30..8e9bb51 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,15 @@ For initializing `JDate` you may either pass an array of Jalali date to it or a ```javascript const JDate = require('jalali-date'); const jdate = new JDate; // => default to today -const jdate2 = new JDate([1393, 10, 11]); -const jdate3 = new JDate(new Date(2014, 1, 3)); +const jdate2 = new JDate(1393, 10, 11); +const jdate3 = new JDate([1393, 10, 11]); +const jdate4 = new JDate(new Date(2014, 1, 3)); ``` ### API ```javascript -jdate.date //=> [1393,5,13] An Array of Jalali Date +jdate.date //=> [1393, 5, 13] An Array of Jalali Date jdate._d // => Gregorian Date Object // Getters @@ -59,7 +60,7 @@ jdate.format('dddd DD MMMM YYYY') // => پنج‌شنبه 12 شهریور 1394 // Static functions JDate.isLeapYear(1393) // => false JDate.daysInMonth(1393, 5) // => 31 -JDate.toGregorian(1393,12,11) // => Gregorian Date object +JDate.toGregorian(1393, 12, 11) // => Gregorian Date object JDate.toJalali(new Date) // => JDate object ``` diff --git a/lib/jdate.js b/lib/jdate.js index 7060173..e6fe622 100644 --- a/lib/jdate.js +++ b/lib/jdate.js @@ -447,7 +447,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d /* * https://github.com/arashm/JDate * @author: Arash Mousavi - * @version: 1.0.0 */ @@ -456,19 +455,29 @@ var JDate = /*#__PURE__*/ function () { function JDate() { - var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date(); - _classCallCheck(this, JDate); - this.input = input; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (Array.isArray(args[0]) || args[0] instanceof Date) { + this.input = args[0]; + } else if (args.length === 3) { + this.input = args; + } else if (!args.length) { + this.input = new Date(); + } else { + throw new Error('Unexpected input'); + } - if (Array.isArray(input)) { - this.date = input.map(function (num) { + if (Array.isArray(this.input)) { + this.date = this.input.map(function (num) { return parseInt(num, 10); }); this._d = this.toGregorian(); - } else if (input instanceof Date) { - this._d = input; + } else if (this.input instanceof Date) { + this._d = this.input; this.date = JDate.toJalali(this.input); } } @@ -687,4 +696,4 @@ function () { /******/ })["default"]; }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9KRGF0ZS93ZWJwYWNrL3VuaXZlcnNhbE1vZHVsZURlZmluaXRpb24iLCJ3ZWJwYWNrOi8vSkRhdGUvd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vSkRhdGUvLi9zcmMvY29uc3RhbnRzLmpzIiwid2VicGFjazovL0pEYXRlLy4vc3JjL2NvbnZlcnRlci5qcyIsIndlYnBhY2s6Ly9KRGF0ZS8uL3NyYy9oZWxwZXJzLmpzIiwid2VicGFjazovL0pEYXRlLy4vc3JjL2pkYXRlLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJNT05USF9OQU1FUyIsIkFCQlJfREFZUyIsIkRBWVNfTkFNRVMiLCJHUkVHT1JJQU5fRVBPQ0giLCJQRVJTSUFOX0VQT0NIIiwiQ29udmVydGVyIiwieWVhciIsIm1vbnRoIiwiZGF5IiwicGFkIiwibGVhcEdyZWdvcmlhbiIsIk1hdGgiLCJmbG9vciIsImpkIiwid2pkIiwiZGVwb2NoIiwicXVhZHJpY2VudCIsImRxYyIsIm1vZCIsImNlbnQiLCJkY2VudCIsInF1YWQiLCJkcXVhZCIsInlpbmRleCIsInllYXJkYXkiLCJncmVnb3JpYW5Ub0p1bG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IG51bWJlciBiZXR3ZWVuIDAgdG8gMzFcbiAgICpcbiAgICogQHBhcmFtcyB7TnVtYmVyfSBkYXRlXG4gICAqIEByZXR1cm4ge0pEYXRlfVxuICAgKi9cbiAgc2V0RGF0ZShkYXRlKSB7XG4gICAgdGhpcy5kYXRlWzJdID0gcGFyc2VJbnQoZGF0ZSwgMTApO1xuICAgIHRoaXMuaW5wdXQgPSB0aGlzLnRvR3JlZ29yaWFuKCk7XG5cbiAgICByZXR1cm4gdGhpcztcbiAgfVxuXG4gIC8qXG4gICAqIFJldHVybnMgdGhlIGRheSBvZiB0aGUgd2VlayBmb3IgdGhlIHNwZWNpZmllZCBkYXRlLiBBIG51bWJlciBiZXR3ZWVuIDAgdG8gNlxuICAgKlxuICAgKiBAcmV0dXJucyB7TnVtYmVyfVxuICAgKi9cbiAgZ2V0RGF5KCkge1xuICAgIHJldHVybiB0aGlzLl9kLmdldERheSgpO1xuICB9XG5cbiAgLypcbiAgICogUmV0dXJucyBhIGZvcm1hdGVkIG91dHB1dCBvZiBjdXJyZW50IGRhdGVcbiAgICpcbiAgICogQHBhcmFtcyB7U3RyaW5nfSBmb3JtYXRcbiAgICogQHJldHVybiB7U3RyaW5nfVxuICAgKi9cbiAgZm9ybWF0KGZvcm1hdCkge1xuICAgIGxldCByZXN1bHQgPSBoZWxwZXJzLnJlcGxhY2VZZWFyKGZvcm1hdCwgdGhpcyk7XG4gICAgcmVzdWx0ID0gaGVscGVycy5yZXBsYWNlTW9udGgocmVzdWx0LCB0aGlzKTtcbiAgICByZXN1bHQgPSBoZWxwZXJzLnJlcGxhY2VEYXkocmVzdWx0LCB0aGlzKTtcblxuICAgIHJldHVybiByZXN1bHQ7XG4gIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9KRGF0ZS93ZWJwYWNrL3VuaXZlcnN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dChmb3JtYXQpIHtcbiAgICBsZXQgcmVzdWx0ID0gaGVscGVycy5yZXBsYWNlWWVhcihmb3JtYXQsIHRoaXMpO1xuICAgIHJlc3VsdCA9IGhlbHBlcnMucmVwbGFjZU1vbnRoKHJlc3VsdCwgdGhpcyk7XG4gICAgcmVzdWx0ID0gaGVscGVycy5yZXBsYWNlRGF5KHJlc3VsdCwgdGhpcyk7XG5cbiAgICByZXR1cm4gcmVzdWx0O1xuICB9XG59XG4iXSwic291cmNlUm9vdCI6IiJ9 \ No newline at end of file diff --git a/lib/jdate.min.js b/lib/jdate.min.js index 2ed4f37..0e10ad7 100644 --- a/lib/jdate.min.js +++ b/lib/jdate.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("JDate",[],t):"object"==typeof exports?exports.JDate=t():e.JDate=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports={MONTH_NAMES:["فروردین","اردیبهشت","خرداد","تیر","امرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],ABBR_DAYS:["۱ش","۲ش","۳ش","۴ش","۵ش","ج","ش"],DAYS_NAMES:["یکشنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه"],GREGORIAN_EPOCH:1721425.5,PERSIAN_EPOCH:1948320.5}},function(e,t,r){"use strict";r.r(t);var n=r(0);function a(e,t){return e-Math.floor(e/t)*t}function o(e){return e&&1===e.length?"0".concat(e):e}function i(e,t){for(var r=0;r0?474:473))%2820+474+38)%2816<682}},{key:"persianToJulian",value:function(e,t,r){var o=e-(e>=0?474:473),i=474+a(o,2820);return r+(t<=7?31*(t-1):30*(t-1)+6)+Math.floor((682*i-110)/2816)+365*(i-1)+1029983*Math.floor(o/2820)+(n.PERSIAN_EPOCH-1)}},{key:"julianToPersian",value:function(t){var r,n=Math.floor(t)+.5,o=n-e.persianToJulian(475,1,1),i=Math.floor(o/1029983),u=a(o,1029983);if(1029982===u)r=2820;else{var l=Math.floor(u/366),f=a(u,366);r=Math.floor((2134*l+2816*f+2815)/1028522)+l+1}var c=r+2820*i+474;c<=0&&(c-=1);var s=n-e.persianToJulian(c,1,1)+1,h=s<=186?Math.ceil(s/31):Math.ceil((s-6)/30);return[c,h,n-e.persianToJulian(c,h,1)+1]}},{key:"persianToGregorian",value:function(t,r,n){var a=e.persianToJulian(t,r,n);return e.julianToGregorian(a)}},{key:"gregorianToPersian",value:function(t,r,n){var a=e.gregorianToJulian(t,r,n);return e.julianToPersian(a)}}],(r=null)&&i(t.prototype,r),o&&i(t,o),e}();function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function f(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:new Date;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.input=t,Array.isArray(t)?(this.date=t.map(function(e){return parseInt(e,10)}),this._d=this.toGregorian()):t instanceof Date&&(this._d=t,this.date=e.toJalali(this.input))}var t,r,a;return t=e,a=[{key:"toJalali",value:function(e){var t=u.gregorianToJulian(e.getFullYear(),e.getMonth()+1,e.getDate());return u.julianToPersian(t)}},{key:"to_jalali",value:function(t){return e.toJalali(t)}},{key:"toGregorian",value:function(e,t,r){var n=u.julianToGregorian(u.persianToJulian(e,t,r));return new Date(n[0],n[1]-1,n[2])}},{key:"to_gregorian",value:function(t,r,n){return e.toGregorian(t,r,n)}},{key:"isLeapYear",value:function(e){return u.leapPersian(e)}},{key:"daysInMonth",value:function(t,r){var n=t-Math.floor(r/12),a=r-12*Math.floor(r/12);return a<0?(a+=12,n-=1):0===a&&(a=12),a<6?31:a<11?30:e.isLeapYear(n)?30:29}}],(r=[{key:"toGregorian",value:function(){return e.toGregorian(this.date[0],this.date[1],this.date[2])}},{key:"getFullYear",value:function(){return this.date[0]}},{key:"setFullYear",value:function(e){return this.date[0]=parseInt(e,10),this.input=this.toGregorian(),this}},{key:"getMonth",value:function(){return this.date[1]}},{key:"setMonth",value:function(e){var t=l(function(e,t){if(t>12||t<=0){var r=Math.floor((t-1)/12);return[e-r,t-12*r]}return[e,t]}(this.getFullYear(),parseInt(e,10)),2);return this.date[0]=t[0],this.date[1]=t[1],this.input=this.toGregorian(),this}},{key:"getDate",value:function(){return this.date[2]}},{key:"setDate",value:function(e){return this.date[2]=parseInt(e,10),this.input=this.toGregorian(),this}},{key:"getDay",value:function(){return this._d.getDay()}},{key:"format",value:function(e){var t=function e(t,r){var n=t.match(/[yY]+/);if(!n)return t;switch(n[0]){case"YYYY":case"YYY":return e(t.replace(n,r.getFullYear()),r);case"YY":return e(t.replace(n,String(r.getFullYear()).slice(2)),r);default:return t}}(e,this);return t=function e(t,r){var a=t.match(/[dD]+/);if(!a)return t;switch(a[0]){case"D":return e(t.replace(a,r.getDate()),r);case"DD":var i=o(r.getDate().toString());return e(t.replace(a,i),r);case"d":case"dd":return e(t.replace(a,n.ABBR_DAYS[r.getDay()]),r);case"ddd":case"dddd":return e(t.replace(a,n.DAYS_NAMES[r.getDay()]),r);default:return t}}(t=function e(t,r){var a=t.match(/[mM]+/);if(!a)return t;switch(a[0]){case"M":return e(t.replace(a,r.getMonth()),r);case"MM":var i=o(r.getMonth().toString());return e(t.replace(a,i),r);case"MMM":case"MMMM":return e(t.replace(a,n.MONTH_NAMES[r.getMonth()-1]),r);default:return t}}(t,this),this)}}])&&f(t.prototype,r),a&&f(t,a),e}()}]).default}); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9KRGF0ZS93ZWJwYWNrL3VuaXZlcnNhbE1vZHVsZURlZmluaXRpb24iLCJ3ZWJwYWNrOi8vSkRhdGUvd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vSkRhdGUvLi9zcmMvY29uc3RhbnRzLmpzIiwid2VicGFjazovL0pEYXRlLy4vc3JjL2hlbHBlcnMuanMiLCJ3ZWJwYWNrOi8vSkRhdGUvLi9zcmMvY29udmVydGVyLmpzIiwid2VicGFjazovL0pEYXRlLy4vc3JjL2pkYXRlLmpzIl0sIm5hbWVzIjpbInJvb3QiLCJmYWN0b3J5IiwiZXhwb3J0cyIsIm1vZHVsZSIsImRlZmluZSIsImFtZCIsInRoaXMiLCJpbnN0YWxsZWRNb2R1bGVzIiwiX193ZWJwYWNrX3JlcXVpcmVfXyIsIm1vZHVsZUlkIiwiaSIsImwiLCJtb2R1bGVzIiwiY2FsbCIsIm0iLCJjIiwiZCIsIm5hbWUiLCJnZXR0ZXIiLCJvIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJlbnVtZXJhYmxlIiwiZ2V0IiwiciIsIlN5bWJvbC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m5zIHtOdW1iZXJ9XG4gICAqL1xuICBnZXREYXkoKSB7XG4gICAgcmV0dXJuIHRoaXMuX2QuZ2V0RGF5KCk7XG4gIH1cblxuICAvKlxuICAgKiBSZXR1cm5zIGEgZm9ybWF0ZWQgb3V0cHV0IG9mIGN1cnJlbnQgZGF0ZVxuICAgKlxuICAgKiBAcGFyYW1zIHtTdHJpbmd9IGZvcm1hdFxuICAgKiBAcmV0dXJuIHtTdHJpbmd9XG4gICAqL1xuICBmb3JtYXQoZm9ybWF0KSB7XG4gICAgbGV0IHJlc3VsdCA9IGhlbHBlcnMucmVwbGFjZVllYXIoZm9ybWF0LCB0aGlzKTtcbiAgICByZXN1bHQgPSBoZWxwZXJzLnJlcGxhY2VNb250aChyZXN1bHQsIHRoaXMpO1xuICAgIHJlc3VsdCA9IGhlbHBlcnMucmVwbGFjZURheShyZXN1bHQsIHRoaXMpO1xuXG4gICAgcmV0dXJuIHJlc3VsdDtcbiAgfVxufVxuIl0sInNvdXJjZVJvb3QiOiIifQ== +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("JDate",[],t):"object"==typeof exports?exports.JDate=t():e.JDate=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports={MONTH_NAMES:["فروردین","اردیبهشت","خرداد","تیر","امرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],ABBR_DAYS:["۱ش","۲ش","۳ش","۴ش","۵ش","ج","ش"],DAYS_NAMES:["یکشنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه"],GREGORIAN_EPOCH:1721425.5,PERSIAN_EPOCH:1948320.5}},function(e,t,r){"use strict";r.r(t);var n=r(0);function a(e,t){return e-Math.floor(e/t)*t}function o(e){return e&&1===e.length?"0".concat(e):e}function i(e,t){for(var r=0;r0?474:473))%2820+474+38)%2816<682}},{key:"persianToJulian",value:function(e,t,r){var o=e-(e>=0?474:473),i=474+a(o,2820);return r+(t<=7?31*(t-1):30*(t-1)+6)+Math.floor((682*i-110)/2816)+365*(i-1)+1029983*Math.floor(o/2820)+(n.PERSIAN_EPOCH-1)}},{key:"julianToPersian",value:function(t){var r,n=Math.floor(t)+.5,o=n-e.persianToJulian(475,1,1),i=Math.floor(o/1029983),u=a(o,1029983);if(1029982===u)r=2820;else{var l=Math.floor(u/366),f=a(u,366);r=Math.floor((2134*l+2816*f+2815)/1028522)+l+1}var c=r+2820*i+474;c<=0&&(c-=1);var s=n-e.persianToJulian(c,1,1)+1,h=s<=186?Math.ceil(s/31):Math.ceil((s-6)/30);return[c,h,n-e.persianToJulian(c,h,1)+1]}},{key:"persianToGregorian",value:function(t,r,n){var a=e.persianToJulian(t,r,n);return e.julianToGregorian(a)}},{key:"gregorianToPersian",value:function(t,r,n){var a=e.gregorianToJulian(t,r,n);return e.julianToPersian(a)}}],(r=null)&&i(t.prototype,r),o&&i(t,o),e}();function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function f(e,t){for(var r=0;r12||t<=0){var r=Math.floor((t-1)/12);return[e-r,t-12*r]}return[e,t]}(this.getFullYear(),parseInt(e,10)),2);return this.date[0]=t[0],this.date[1]=t[1],this.input=this.toGregorian(),this}},{key:"getDate",value:function(){return this.date[2]}},{key:"setDate",value:function(e){return this.date[2]=parseInt(e,10),this.input=this.toGregorian(),this}},{key:"getDay",value:function(){return this._d.getDay()}},{key:"format",value:function(e){var t=function e(t,r){var n=t.match(/[yY]+/);if(!n)return t;switch(n[0]){case"YYYY":case"YYY":return e(t.replace(n,r.getFullYear()),r);case"YY":return e(t.replace(n,String(r.getFullYear()).slice(2)),r);default:return t}}(e,this);return t=function e(t,r){var a=t.match(/[dD]+/);if(!a)return t;switch(a[0]){case"D":return e(t.replace(a,r.getDate()),r);case"DD":var i=o(r.getDate().toString());return e(t.replace(a,i),r);case"d":case"dd":return e(t.replace(a,n.ABBR_DAYS[r.getDay()]),r);case"ddd":case"dddd":return e(t.replace(a,n.DAYS_NAMES[r.getDay()]),r);default:return t}}(t=function e(t,r){var a=t.match(/[mM]+/);if(!a)return t;switch(a[0]){case"M":return e(t.replace(a,r.getMonth()),r);case"MM":var i=o(r.getMonth().toString());return e(t.replace(a,i),r);case"MMM":case"MMMM":return e(t.replace(a,n.MONTH_NAMES[r.getMonth()-1]),r);default:return t}}(t,this),this)}}])&&f(t.prototype,r),a&&f(t,a),e}()}]).default}); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9KRGF0ZS93ZWJwYWNrL3VuaXZlcnNhbE1vZHVsZURlZmluaXRpb24iLCJ3ZWJwYWNrOi8vSkRhdGUvd2VicGFjay9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5IG9mIHRoZSB3ZWVrIGZvciB0aGUgc3BlY2lmaWVkIGRhdGUuIEEgbnVtYmVyIGJldHdlZW4gMCB0byA2XG4gICAqXG4gICAqIEByZXR1cm5zIHtOdW1iZXJ9XG4gICAqL1xuICBnZXREYXkoKSB7XG4gICAgcmV0dXJuIHRoaXMuX2QuZ2V0RGF5KCk7XG4gIH1cblxuICAvKlxuICAgKiBSZXR1cm5zIGEgZm9ybWF0ZWQgb3V0cHV0IG9mIGN1cnJlbnQgZGF0ZVxuICAgKlxuICAgKiBAcGFyYW1zIHtTdHJpbmd9IGZvcm1hdFxuICAgKiBAcmV0dXJuIHtTdHJpbmd9XG4gICAqL1xuICBmb3JtYXQoZm9ybWF0KSB7XG4gICAgbGV0IHJlc3VsdCA9IGhlbHBlcnMucmVwbGFjZVllYXIoZm9ybWF0LCB0aGlzKTtcbiAgICByZXN1bHQgPSBoZWxwZXJzLnJlcGxhY2VNb250aChyZXN1bHQsIHRoaXMpO1xuICAgIHJlc3VsdCA9IGhlbHBlcnMucmVwbGFjZURheShyZXN1bHQsIHRoaXMpO1xuXG4gICAgcmV0dXJuIHJlc3VsdDtcbiAgfVxufVxuIl0sInNvdXJjZVJvb3QiOiIifQ== \ No newline at end of file diff --git a/src/jdate.js b/src/jdate.js index 9ef8dc6..09e5994 100644 --- a/src/jdate.js +++ b/src/jdate.js @@ -7,13 +7,22 @@ import Converter from './converter'; import * as helpers from './helpers'; export default class JDate { - constructor(input = new Date()) { - this.input = input; - if (Array.isArray(input)) { - this.date = input.map((num) => parseInt(num, 10)); + constructor(...args) { + if (Array.isArray(args[0]) || args[0] instanceof Date) { + [this.input] = args; + } else if (args.length === 3) { + this.input = args; + } else if (!args.length) { + this.input = new Date(); + } else { + throw new Error('Unexpected input'); + } + + if (Array.isArray(this.input)) { + this.date = this.input.map((num) => parseInt(num, 10)); this._d = this.toGregorian(); - } else if (input instanceof Date) { - this._d = input; + } else if (this.input instanceof Date) { + this._d = this.input; this.date = JDate.toJalali(this.input); } } diff --git a/tests/jdate.test.js b/tests/jdate.test.js index 16018ab..34ce141 100644 --- a/tests/jdate.test.js +++ b/tests/jdate.test.js @@ -21,6 +21,17 @@ describe('JDate', () => { expect(jdate._d.getDate()).toEqual(1); }); + it('should convert by passing just integers', () => { + const jdate = new JDate(1396, 10, 11); + + expect(jdate.date).toEqual([1396, 10, 11]); + expect(jdate.input).toEqual([1396, 10, 11]); + expect(jdate._d).toBeInstanceOf(Date); + expect(jdate._d.getFullYear()).toEqual(2018); + expect(jdate._d.getMonth()).toEqual(0); + expect(jdate._d.getDate()).toEqual(1); + }); + it('should convert a JS date object', () => { const currentDate = new Date(2018, 0, 1); const jdate = new JDate(currentDate);