diff --git a/README.md b/README.md index 8d6641f..c2a7260 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Include js in `/dist` by tag , you can also require js by `require('date-range-p var configs1 = { lang: 'zh-cn', // using language numberOfCalendars: 1, // displaying month number + calendarType: 'day', // type of calendar, day, week or month, dafault 'day' type: 'single', // single, range, terminal time: true, // want display & ctrl hours and minutes or not date: moment('2015-10-01 23:33'), // default date for type single diff --git a/package.json b/package.json index aa0ecc0..2313934 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "date-range-picker", - "version": "0.2.4", + "version": "0.2.5", "description": "a simple daterangepicker", "main": "dist/daterangepicker.min.js", "scripts": { diff --git a/src/Calendar.js b/src/Calendar.js index d81167b..b54b87d 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -8,12 +8,12 @@ class Calendar{ constructor(that, callback) { // 渲染header, 再渲染多个月份的日历 var {el, config} = that; - var {numberOfCalendars, lang, maxDate, minDate, calendar} = config; + var {numberOfCalendars, lang, maxDate, minDate, calendarType} = config; this.el = createElement('div', 'drp-calendar'); this.unitEl = null; this.parent = el; this.calNum = numberOfCalendars; - this.type = calendar || 'day'; + this.type = calendarType || 'day'; this.current = that.range ? moment(that.range.start) : that.date ? moment(that.date) : moment(); @@ -43,7 +43,8 @@ class Calendar{ this.drawPointer(); for(var i = 0; i < this.calNum; i++) { this.unitEl = createElement('div', 'drp-unit'); - this.current = this.current.date(1).add(1, 'month'); + if(!this.isMonth) this.current = this.current.date(1).add(1, 'month'); + else this.current = this.current.month(0).date(1).add(1, 'year'); this.drawHeader(i); this.isMonth ? this.drawYear() : this.drawMonth(); this.el.appendChild(this.unitEl); diff --git a/src/main.css b/src/main.css index f271b51..b10229d 100644 --- a/src/main.css +++ b/src/main.css @@ -75,7 +75,7 @@ } .drp-week.longer .drp-day { - width: 155px; + width: 175px; .drp-day-number, .drp-day-static { width: 100%; } @@ -281,4 +281,5 @@ .drp-unit { display: inline-block; + width: 100%; }