Socket
Socket
Sign inDemoInstall

react-date-picker

Package Overview
Dependencies
Maintainers
1
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-date-picker - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

23

dist/react-date-picker.nomoment.js

@@ -72,2 +72,8 @@ (function webpackUniversalModuleDefinition(root, factory) {

// if (React.createFactory){
// MonthView = React.createFactory(MonthView)
// YearView = React.createFactory(YearView)
// DecadeView = React.createFactory(DecadeView)
// }
var Views = {

@@ -127,2 +133,13 @@ month : MonthView,

getViewFactory: function() {
var view = this.getView()
if (React.createFactory){
view.__factory = view.__factory || React.createFactory(view)
view = view.__factory
}
return view
},
getViewDate: function() {

@@ -136,3 +153,3 @@ return this.state.viewMoment || this.props.viewDate || this.props.date || this.now

var view = this.getView()
var view = this.getViewFactory()
var props = asConfig(this.props)

@@ -162,2 +179,6 @@

renderFooter: function() {
if (this.props.hideFooter){
return
}
var todayText = this.props.today || 'Today'

@@ -164,0 +185,0 @@ var gotoSelected = this.props.gotoSelected || 'Go to selected'

2

dist/react-date-picker.nomoment.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment"),require("React")):"function"==typeof define&&define.amd?define(["moment","React"],e):"object"==typeof exports?exports.DatePicker=e(require("moment"),require("React")):t.DatePicker=e(t.moment,t.React)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(){}var a=r(5),o=r(1),i=r(2),s=i.copy,p=(i.copyList,r(4)),u=r(16),c=r(17),d=r(15),h={month:u,year:c,decade:d},l=(r(10),a.createClass({displayName:"DatePicker",getInitialState:function(){return{}},getDefaultProps:function(){return p()},getViewName:function(){return this.state.view||this.props.view||"month"},getViewOrder:function(){return["month","year","decade"]},addViewIndex:function(t){var e=this.getViewName(),r=this.getViewOrder(),n=r.indexOf(e);return n+=t,n%r.length},getNextViewName:function(){return this.getViewOrder()[this.addViewIndex(1)]},getPrevViewName:function(){return this.getViewOrder()[this.addViewIndex(-1)]},getView:function(){return h[this.getViewName()]||h.month},getViewDate:function(){return this.state.viewMoment||this.props.viewDate||this.props.date||this.now},render:function(){this.now=+new Date;var t=this.getView(),e=p(this.props);return e.viewDate=this.getViewDate(),e.onChange=this.handleChange,e.onSelect=this.handleSelect,a.DOM.div(s({className:(this.props.className||"")+" date-picker"},this.props),a.DOM.div({className:"dp-inner"},this.renderHeader(t),a.DOM.div({className:"dp-body"},a.DOM.div({className:"dp-anim-target"},t(e))),this.renderFooter()))},renderFooter:function(){var t=this.props.today||"Today",e=this.props.gotoSelected||"Go to selected";return a.DOM.div({className:"dp-footer"},a.DOM.div({className:"dp-footer-today",onClick:this.gotoNow},t),a.DOM.div({className:"dp-footer-selected",onClick:this.gotoSelected},e))},gotoNow:function(){this.gotoDate(+new Date)},gotoSelected:function(){this.gotoDate(this.props.date||+new Date)},gotoDate:function(t){this.setState({view:"month",viewMoment:o(t)})},getViewColspan:function(){var t={month:5,year:2,decade:2};return t[this.getViewName()]},renderHeader:function(){var t=this.getViewDate(),e=this.getView().getHeaderText(t),r=this.getViewColspan(),n=this.props.navPrev,o=this.props.navNext;return a.DOM.div({className:"dp-header"},a.DOM.table({className:"dp-nav-table"},a.DOM.tbody(null,a.DOM.tr({className:"dp-row"},a.DOM.td({className:"dp-prev-nav dp-nav-cell dp-cell",onClick:this.handlePrevNav},n),a.DOM.td({className:"dp-nav-view dp-cell ",colSpan:r,onClick:this.handleViewChange},e),a.DOM.td({className:"dp-next-nav dp-nav-cell dp-cell",onClick:this.handleNextNav},o)))))},handleViewChange:function(){this.setState({view:this.getNextViewName()})},getNext:function(){var t=this.getViewDate();return{month:function(){return o(t).add(1,"month")},year:function(){return o(t).add(1,"year")},decade:function(){return o(t).add(10,"year")}}[this.getViewName()]()},getPrev:function(){var t=this.getViewDate();return{month:function(){return o(t).add(-1,"month")},year:function(){return o(t).add(-1,"year")},decade:function(){return o(t).add(-10,"year")}}[this.getViewName()]()},handlePrevNav:function(t){(this.props.onNav||n)(t),this.setState({viewMoment:this.getPrev()})},handleNextNav:function(t){(this.props.onNav||n)(t),this.setState({viewMoment:this.getNext()})},handleChange:function(t,e){t=o(t);var r=t.format(this.props.dateFormat);(this.props.onChange||n)(t,r,e)},handleSelect:function(t,e){var r=this.getViewName(),a={decade:"year",year:"month"}[r],i=t.get(a),s=o(this.getViewDate()).set(a,i);this.setState({viewMoment:s,view:this.getPrevViewName()}),(this.props.onSelect||n)(o(s),e)}}));t.exports=l},function(e){e.exports=t},function(t,e,r){t.exports=function(){"use strict";var t=Object.prototype.hasOwnProperty,e="object",n="undefined";return{copy:r(11),copyIf:r(12),copyAs:function(r,n){var a={};if(n=n||1,null!=r&&typeof r===e)for(var o in r)t.call(r,o)&&(a[o]=n);return a},copyList:r(8),copyListIf:r(9),copyKeys:r(13),copyKeysIf:r(14),copyExceptKeys:function(r,n,a){if(n=n||{},a=a||{},null!=r&&typeof r===e)for(var o in r)t.call(r,o)&&!t.call(a,o)&&(n[o]=r[o]);return n},bindCopyKeys:function(r,a,o){if(2==arguments.length&&(o=a,a=null),a=a||{},null!=r&&typeof r===e&&null!=o&&typeof o===e){var i,s,p,u;for(var c in o)t.call(o,c)&&(s=o[c],i=typeof s,u=r[c],p=typeof u,p!==n&&(a["string"==i?s:c]="function"==p?u.bind(r):u))}return a}}}()},function(t,e,r){"use strict";var n=r(1),a=r(6);t.exports=function(t,e,r){var o=!(!r||!r.strict);return e=e||a.dateFormat,"string"==typeof t?n(t,e,o):n(null==t?new Date:t)}},function(t,e,r){"use strict";var n=r(2),a=n.copy,o=n.copyList,i=r(6),s=Object.keys(i);t.exports=function(t,e){var r=s;return e&&(r=Object.keys(e)),e=e||i,t?o(t,a(e),r):a(e)}},function(t){t.exports=e},function(t,e,r){"use strict";var n=r(10);t.exports={weekDayNames:n(),weekStartDay:0,dayFormat:"D",monthFormat:"MMMM",yearFormat:"YYYY",navPrev:"‹",navNext:"›",view:"month",date:null,minDate:null,maxDate:null,viewDate:null,dateFormat:"YYYY-MM-DD"}},function(t,e,r){"use strict";function n(t,e){return o(t).format(e)}var a=r(6),o=r(3);t.exports={day:function(t,e){return n(t,e||a.dayFormat)},month:function(t,e){return n(t,e||a.monthFormat)},year:function(t,e){return n(t,e||a.yearFormat)}}},function(t){"use strict";var e="undefined";t.exports=function(t,r,n){arguments.length<3&&(n=r,r=null),r=r||{},n=n||Object.keys(t);for(var a,o=0,i=n.length;i>o;o++)a=n[o],typeof t[a]!==e&&(r[n[o]]=t[n[o]]);return r}},function(t){"use strict";var e="undefined";t.exports=function(t,r,n){arguments.length<3&&(n=r,r=null),r=r||{},n=n||Object.keys(t);for(var a,o=0,i=n.length;i>o;o++)a=n[o],typeof t[a]!==e&&typeof r[a]===e&&(r[a]=t[a]);return r}},function(t,e,r){"use strict";var n=r(1),a=1*n().startOf("week").format("d");t.exports=function(t){var e=n.weekdaysShort();if(void 0!==t&&a!=t)for(var r=t;r>a;)e.push(e.shift()),r--;return e}},function(t){"use strict";var e=Object.prototype.hasOwnProperty,r="object";t.exports=function(t,n){if(n=n||{},null!=t&&typeof t===r)for(var a in t)e.call(t,a)&&(n[a]=t[a]);return n}},function(t){"use strict";var e=Object.prototype.hasOwnProperty,r="object",n="undefined";t.exports=function(t,a){if(a=a||{},null!=t&&typeof t===r)for(var o in t)e.call(t,o)&&typeof a[o]===n&&(a[o]=t[o]);return a}},function(t,e,r){"use strict";var n="undefined",a="object",o=Object.prototype.hasOwnProperty,i=r(8);t.exports=function(t,e,r){if(arguments.length<3&&(r=e,e=null),e=e||{},!r||Array.isArray(r))return i(t,e,r);if(null!=t&&typeof t===a&&null!=r&&typeof r===a){var s,p;for(var u in r)o.call(r,u)&&(p=r[u],s=typeof p,typeof t[u]!==n&&(e["string"==s?p:u]=t[u]))}return e}},function(t,e,r){"use strict";var n="undefined",a="object",o=Object.prototype.hasOwnProperty,i=r(9);t.exports=function(t,e,r){if(arguments.length<3&&(r=e,e=null),e=e||{},!r||Array.isArray(r))return i(t,e,r);if(null!=t&&typeof t===a&&null!=r&&typeof r===a){var s,p,u;for(var c in r)o.call(r,c)&&(p=r[c],s=typeof p,u="string"==s?p:c,typeof t[c]!==n&&typeof e[u]===n&&(e[u]=t[c]))}return e}},function(t,e,r){"use strict";function n(){}var a,o=r(5),i=r(1),s=r(2).copy,p=r(7),u=r(4),c=(r(3),o.createClass({displayName:"DecadeView",getDefaultProps:function(){return u()},getYearsInDecade:function(t){var e=i(t).get("year"),r=e%10;e=e-r-1;for(var n=[],a=0,o=i(e,"YYYY").startOf("year");12>a;a++)n.push(i(o)),o.add(1,"year");return n},render:function(){a=+i().startOf("day");var t=this.props.viewMoment=i(this.props.viewDate);this.props.date&&(this.props.moment=i(this.props.date).startOf("year"));var e=this.getYearsInDecade(t);return o.DOM.table({className:"dp-table dp-decade-view"},o.DOM.tbody(null,this.renderYears(e)))},renderYears:function(t){for(var e=t.map(this.renderYear,this),r=t.length,n=[],a=Math.ceil(r/4),i=0;a>i;i++)n.push(e.slice(4*i,4*(i+1)));return n.map(function(t,e){return o.DOM.tr({key:"row"+e},t)})},renderYear:function(t,e,r){var n=p.year(t),a=["dp-cell dp-year"],i=+t;return i==this.props.moment&&a.push("dp-value"),e||a.push("dp-prev"),e==r.length-1&&a.push("dp-next"),o.DOM.td({key:n,className:a.join(" "),onClick:this.handleClick.bind(this,t)},n)},handleClick:function(t){event.target.value=t,(this.props.onSelect||n)(t,event)}}));s({getHeaderText:function(t){var e=i(t).get("year"),r=e%10;return e=e-r-1,e+" - "+(e+11)}},c),t.exports=c},function(t,e,r){"use strict";function n(){}var a,o=r(5),i=r(1),s=r(2).copy,p=r(7),u=r(4),c=r(3),d=o.createClass({displayName:"MonthView",formatAsDay:function(t,e){return t.format(e||"D")},getDefaultProps:function(){return u()},getWeekStartMoment:function(t){var e=i(t).startOf("week");return e},getDaysInMonth:function(t){var e=i(t).startOf("month"),r=this.getWeekStartMoment(e),n=[],a=0;for(e.add(-1,"days").isBefore(r)&&r.add(-1,"weeks");42>a;a++)n.push(i(r)),r.add(1,"days");return n},render:function(){a=+i().startOf("day");var t=this.props.viewMoment=c(this.props.viewDate,this.props.dateFormat);this.props.minDate&&(this.props.minDate=+c(this.props.minDate,this.props.dateFormat)),this.props.maxDate&&(this.props.maxDate=+c(this.props.maxDate,this.props.dateFormat)),this.props.minDate,this.monthFirst=i(t).startOf("month"),this.monthLast=i(t).endOf("month"),this.props.date&&(this.props.moment=i(this.props.date).startOf("day"));var e=this.getDaysInMonth(t);return o.DOM.table({className:"dp-table dp-month-view"},o.DOM.tbody(null,this.renderWeekDayNames(),this.renderDays(e)))},renderDays:function(t){for(var e=t.map(this.renderDay,this),r=t.length,n=[],a=Math.ceil(r/7),i=0;a>i;i++)n.push(e.slice(7*i,7*(i+1)));return n.map(function(t,e){return o.DOM.tr({key:"row"+e,className:"dp-week dp-row"},t)})},renderDay:function(t){var e=p.day(t),r=["dp-cell dp-day"],n=+t;return n==a?r.push("dp-current"):n<this.monthFirst?r.push("dp-prev"):n>this.monthLast&&r.push("dp-next"),this.props.minDate&&t<this.props.minDate&&r.push("dp-disabled dp-before-min"),this.props.maxDate&&t>this.props.maxDate&&r.push("dp-disabled dp-after-max"),n==this.props.moment&&r.push("dp-value"),o.DOM.td({key:e,className:r.join(" "),onClick:this.handleClick.bind(this,t,n)},e)},renderWeekDayNames:function(){var t=this.props.weekDayNames;return o.DOM.tr({className:"dp-row dp-week-day-names"},t.map(function(t){return o.DOM.td({key:t,className:"dp-cell dp-week-day-name"},t)}))},handleClick:function(t,e,r){this.props.minDate&&e<this.props.minDate||this.props.maxDate&&e>this.props.maxDate||(r.target.value=t,(this.props.onChange||n)(t,r))}});s({getHeaderText:function(t){return c(t).format("MMMM YYYY")}},d),t.exports=d},function(t,e,r){"use strict";function n(){}var a,o=r(5),i=r(1),s=r(2).copy,p=r(7),u=r(4),c=r(3),d=o.createClass({displayName:"YearView",getDefaultProps:function(){return u()},getMonthsInYear:function(t){for(var e=i(t).startOf("year"),r=[],n=0;12>n;n++)r.push(i(e)),e.add(1,"month");return r},render:function(){a=+i().startOf("day");var t=this.props.viewMoment=i(this.props.viewDate);this.props.date&&(this.props.moment=i(this.props.date).startOf("month"));var e=this.getMonthsInYear(t);return o.DOM.table({className:"dp-table dp-year-view"},o.DOM.tbody(null,this.renderMonths(e)))},renderMonths:function(t){for(var e=t.map(this.renderMonth,this),r=t.length,n=[],a=Math.ceil(r/4),i=0;a>i;i++)n.push(e.slice(4*i,4*(i+1)));return n.map(function(t,e){return o.DOM.tr({key:"row"+e},t)})},renderMonth:function(t){var e=p.month(t),r=["dp-cell dp-month"],n=+t;return n==this.props.moment&&r.push("dp-value"),o.DOM.td({key:e,className:r.join(" "),onClick:this.handleClick.bind(this,t)},e)},handleClick:function(t){event.target.value=t,(this.props.onSelect||n)(t,event)}});s({getHeaderText:function(t){return c(t).format("YYYY")}},d),t.exports=d}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment"),require("React")):"function"==typeof define&&define.amd?define(["moment","React"],e):"object"==typeof exports?exports.DatePicker=e(require("moment"),require("React")):t.DatePicker=e(t.moment,t.React)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(){}var a=r(5),o=r(1),i=r(2),s=i.copy,p=(i.copyList,r(4)),c=r(16),u=r(17),d=r(15),h={month:c,year:u,decade:d},f=(r(10),a.createClass({displayName:"DatePicker",getInitialState:function(){return{}},getDefaultProps:function(){return p()},getViewName:function(){return this.state.view||this.props.view||"month"},getViewOrder:function(){return["month","year","decade"]},addViewIndex:function(t){var e=this.getViewName(),r=this.getViewOrder(),n=r.indexOf(e);return n+=t,n%r.length},getNextViewName:function(){return this.getViewOrder()[this.addViewIndex(1)]},getPrevViewName:function(){return this.getViewOrder()[this.addViewIndex(-1)]},getView:function(){return h[this.getViewName()]||h.month},getViewFactory:function(){var t=this.getView();return a.createFactory&&(t.__factory=t.__factory||a.createFactory(t),t=t.__factory),t},getViewDate:function(){return this.state.viewMoment||this.props.viewDate||this.props.date||this.now},render:function(){this.now=+new Date;var t=this.getViewFactory(),e=p(this.props);return e.viewDate=this.getViewDate(),e.onChange=this.handleChange,e.onSelect=this.handleSelect,a.DOM.div(s({className:(this.props.className||"")+" date-picker"},this.props),a.DOM.div({className:"dp-inner"},this.renderHeader(t),a.DOM.div({className:"dp-body"},a.DOM.div({className:"dp-anim-target"},t(e))),this.renderFooter()))},renderFooter:function(){if(!this.props.hideFooter){var t=this.props.today||"Today",e=this.props.gotoSelected||"Go to selected";return a.DOM.div({className:"dp-footer"},a.DOM.div({className:"dp-footer-today",onClick:this.gotoNow},t),a.DOM.div({className:"dp-footer-selected",onClick:this.gotoSelected},e))}},gotoNow:function(){this.gotoDate(+new Date)},gotoSelected:function(){this.gotoDate(this.props.date||+new Date)},gotoDate:function(t){this.setState({view:"month",viewMoment:o(t)})},getViewColspan:function(){var t={month:5,year:2,decade:2};return t[this.getViewName()]},renderHeader:function(){var t=this.getViewDate(),e=this.getView().getHeaderText(t),r=this.getViewColspan(),n=this.props.navPrev,o=this.props.navNext;return a.DOM.div({className:"dp-header"},a.DOM.table({className:"dp-nav-table"},a.DOM.tbody(null,a.DOM.tr({className:"dp-row"},a.DOM.td({className:"dp-prev-nav dp-nav-cell dp-cell",onClick:this.handlePrevNav},n),a.DOM.td({className:"dp-nav-view dp-cell ",colSpan:r,onClick:this.handleViewChange},e),a.DOM.td({className:"dp-next-nav dp-nav-cell dp-cell",onClick:this.handleNextNav},o)))))},handleViewChange:function(){this.setState({view:this.getNextViewName()})},getNext:function(){var t=this.getViewDate();return{month:function(){return o(t).add(1,"month")},year:function(){return o(t).add(1,"year")},decade:function(){return o(t).add(10,"year")}}[this.getViewName()]()},getPrev:function(){var t=this.getViewDate();return{month:function(){return o(t).add(-1,"month")},year:function(){return o(t).add(-1,"year")},decade:function(){return o(t).add(-10,"year")}}[this.getViewName()]()},handlePrevNav:function(t){(this.props.onNav||n)(t),this.setState({viewMoment:this.getPrev()})},handleNextNav:function(t){(this.props.onNav||n)(t),this.setState({viewMoment:this.getNext()})},handleChange:function(t,e){t=o(t);var r=t.format(this.props.dateFormat);(this.props.onChange||n)(t,r,e)},handleSelect:function(t,e){var r=this.getViewName(),a={decade:"year",year:"month"}[r],i=t.get(a),s=o(this.getViewDate()).set(a,i);this.setState({viewMoment:s,view:this.getPrevViewName()}),(this.props.onSelect||n)(o(s),e)}}));t.exports=f},function(e){e.exports=t},function(t,e,r){t.exports=function(){"use strict";var t=Object.prototype.hasOwnProperty,e="object",n="undefined";return{copy:r(11),copyIf:r(12),copyAs:function(r,n){var a={};if(n=n||1,null!=r&&typeof r===e)for(var o in r)t.call(r,o)&&(a[o]=n);return a},copyList:r(8),copyListIf:r(9),copyKeys:r(13),copyKeysIf:r(14),copyExceptKeys:function(r,n,a){if(n=n||{},a=a||{},null!=r&&typeof r===e)for(var o in r)t.call(r,o)&&!t.call(a,o)&&(n[o]=r[o]);return n},bindCopyKeys:function(r,a,o){if(2==arguments.length&&(o=a,a=null),a=a||{},null!=r&&typeof r===e&&null!=o&&typeof o===e){var i,s,p,c;for(var u in o)t.call(o,u)&&(s=o[u],i=typeof s,c=r[u],p=typeof c,p!==n&&(a["string"==i?s:u]="function"==p?c.bind(r):c))}return a}}}()},function(t,e,r){"use strict";var n=r(1),a=r(6);t.exports=function(t,e,r){var o=!(!r||!r.strict);return e=e||a.dateFormat,"string"==typeof t?n(t,e,o):n(null==t?new Date:t)}},function(t,e,r){"use strict";var n=r(2),a=n.copy,o=n.copyList,i=r(6),s=Object.keys(i);t.exports=function(t,e){var r=s;return e&&(r=Object.keys(e)),e=e||i,t?o(t,a(e),r):a(e)}},function(t){t.exports=e},function(t,e,r){"use strict";var n=r(10);t.exports={weekDayNames:n(),weekStartDay:0,dayFormat:"D",monthFormat:"MMMM",yearFormat:"YYYY",navPrev:"‹",navNext:"›",view:"month",date:null,minDate:null,maxDate:null,viewDate:null,dateFormat:"YYYY-MM-DD"}},function(t,e,r){"use strict";function n(t,e){return o(t).format(e)}var a=r(6),o=r(3);t.exports={day:function(t,e){return n(t,e||a.dayFormat)},month:function(t,e){return n(t,e||a.monthFormat)},year:function(t,e){return n(t,e||a.yearFormat)}}},function(t){"use strict";var e="undefined";t.exports=function(t,r,n){arguments.length<3&&(n=r,r=null),r=r||{},n=n||Object.keys(t);for(var a,o=0,i=n.length;i>o;o++)a=n[o],typeof t[a]!==e&&(r[n[o]]=t[n[o]]);return r}},function(t){"use strict";var e="undefined";t.exports=function(t,r,n){arguments.length<3&&(n=r,r=null),r=r||{},n=n||Object.keys(t);for(var a,o=0,i=n.length;i>o;o++)a=n[o],typeof t[a]!==e&&typeof r[a]===e&&(r[a]=t[a]);return r}},function(t,e,r){"use strict";var n=r(1),a=1*n().startOf("week").format("d");t.exports=function(t){var e=n.weekdaysShort();if(void 0!==t&&a!=t)for(var r=t;r>a;)e.push(e.shift()),r--;return e}},function(t){"use strict";var e=Object.prototype.hasOwnProperty,r="object";t.exports=function(t,n){if(n=n||{},null!=t&&typeof t===r)for(var a in t)e.call(t,a)&&(n[a]=t[a]);return n}},function(t){"use strict";var e=Object.prototype.hasOwnProperty,r="object",n="undefined";t.exports=function(t,a){if(a=a||{},null!=t&&typeof t===r)for(var o in t)e.call(t,o)&&typeof a[o]===n&&(a[o]=t[o]);return a}},function(t,e,r){"use strict";var n="undefined",a="object",o=Object.prototype.hasOwnProperty,i=r(8);t.exports=function(t,e,r){if(arguments.length<3&&(r=e,e=null),e=e||{},!r||Array.isArray(r))return i(t,e,r);if(null!=t&&typeof t===a&&null!=r&&typeof r===a){var s,p;for(var c in r)o.call(r,c)&&(p=r[c],s=typeof p,typeof t[c]!==n&&(e["string"==s?p:c]=t[c]))}return e}},function(t,e,r){"use strict";var n="undefined",a="object",o=Object.prototype.hasOwnProperty,i=r(9);t.exports=function(t,e,r){if(arguments.length<3&&(r=e,e=null),e=e||{},!r||Array.isArray(r))return i(t,e,r);if(null!=t&&typeof t===a&&null!=r&&typeof r===a){var s,p,c;for(var u in r)o.call(r,u)&&(p=r[u],s=typeof p,c="string"==s?p:u,typeof t[u]!==n&&typeof e[c]===n&&(e[c]=t[u]))}return e}},function(t,e,r){"use strict";function n(){}var a,o=r(5),i=r(1),s=r(2).copy,p=r(7),c=r(4),u=(r(3),o.createClass({displayName:"DecadeView",getDefaultProps:function(){return c()},getYearsInDecade:function(t){var e=i(t).get("year"),r=e%10;e=e-r-1;for(var n=[],a=0,o=i(e,"YYYY").startOf("year");12>a;a++)n.push(i(o)),o.add(1,"year");return n},render:function(){a=+i().startOf("day");var t=this.props.viewMoment=i(this.props.viewDate);this.props.date&&(this.props.moment=i(this.props.date).startOf("year"));var e=this.getYearsInDecade(t);return o.DOM.table({className:"dp-table dp-decade-view"},o.DOM.tbody(null,this.renderYears(e)))},renderYears:function(t){for(var e=t.map(this.renderYear,this),r=t.length,n=[],a=Math.ceil(r/4),i=0;a>i;i++)n.push(e.slice(4*i,4*(i+1)));return n.map(function(t,e){return o.DOM.tr({key:"row"+e},t)})},renderYear:function(t,e,r){var n=p.year(t),a=["dp-cell dp-year"],i=+t;return i==this.props.moment&&a.push("dp-value"),e||a.push("dp-prev"),e==r.length-1&&a.push("dp-next"),o.DOM.td({key:n,className:a.join(" "),onClick:this.handleClick.bind(this,t)},n)},handleClick:function(t){event.target.value=t,(this.props.onSelect||n)(t,event)}}));s({getHeaderText:function(t){var e=i(t).get("year"),r=e%10;return e=e-r-1,e+" - "+(e+11)}},u),t.exports=u},function(t,e,r){"use strict";function n(){}var a,o=r(5),i=r(1),s=r(2).copy,p=r(7),c=r(4),u=r(3),d=o.createClass({displayName:"MonthView",formatAsDay:function(t,e){return t.format(e||"D")},getDefaultProps:function(){return c()},getWeekStartMoment:function(t){var e=i(t).startOf("week");return e},getDaysInMonth:function(t){var e=i(t).startOf("month"),r=this.getWeekStartMoment(e),n=[],a=0;for(e.add(-1,"days").isBefore(r)&&r.add(-1,"weeks");42>a;a++)n.push(i(r)),r.add(1,"days");return n},render:function(){a=+i().startOf("day");var t=this.props.viewMoment=u(this.props.viewDate,this.props.dateFormat);this.props.minDate&&(this.props.minDate=+u(this.props.minDate,this.props.dateFormat)),this.props.maxDate&&(this.props.maxDate=+u(this.props.maxDate,this.props.dateFormat)),this.props.minDate,this.monthFirst=i(t).startOf("month"),this.monthLast=i(t).endOf("month"),this.props.date&&(this.props.moment=i(this.props.date).startOf("day"));var e=this.getDaysInMonth(t);return o.DOM.table({className:"dp-table dp-month-view"},o.DOM.tbody(null,this.renderWeekDayNames(),this.renderDays(e)))},renderDays:function(t){for(var e=t.map(this.renderDay,this),r=t.length,n=[],a=Math.ceil(r/7),i=0;a>i;i++)n.push(e.slice(7*i,7*(i+1)));return n.map(function(t,e){return o.DOM.tr({key:"row"+e,className:"dp-week dp-row"},t)})},renderDay:function(t){var e=p.day(t),r=["dp-cell dp-day"],n=+t;return n==a?r.push("dp-current"):n<this.monthFirst?r.push("dp-prev"):n>this.monthLast&&r.push("dp-next"),this.props.minDate&&t<this.props.minDate&&r.push("dp-disabled dp-before-min"),this.props.maxDate&&t>this.props.maxDate&&r.push("dp-disabled dp-after-max"),n==this.props.moment&&r.push("dp-value"),o.DOM.td({key:e,className:r.join(" "),onClick:this.handleClick.bind(this,t,n)},e)},renderWeekDayNames:function(){var t=this.props.weekDayNames;return o.DOM.tr({className:"dp-row dp-week-day-names"},t.map(function(t){return o.DOM.td({key:t,className:"dp-cell dp-week-day-name"},t)}))},handleClick:function(t,e,r){this.props.minDate&&e<this.props.minDate||this.props.maxDate&&e>this.props.maxDate||(r.target.value=t,(this.props.onChange||n)(t,r))}});s({getHeaderText:function(t){return u(t).format("MMMM YYYY")}},d),t.exports=d},function(t,e,r){"use strict";function n(){}var a,o=r(5),i=r(1),s=r(2).copy,p=r(7),c=r(4),u=r(3),d=o.createClass({displayName:"YearView",getDefaultProps:function(){return c()},getMonthsInYear:function(t){for(var e=i(t).startOf("year"),r=[],n=0;12>n;n++)r.push(i(e)),e.add(1,"month");return r},render:function(){a=+i().startOf("day");var t=this.props.viewMoment=i(this.props.viewDate);this.props.date&&(this.props.moment=i(this.props.date).startOf("month"));var e=this.getMonthsInYear(t);return o.DOM.table({className:"dp-table dp-year-view"},o.DOM.tbody(null,this.renderMonths(e)))},renderMonths:function(t){for(var e=t.map(this.renderMonth,this),r=t.length,n=[],a=Math.ceil(r/4),i=0;a>i;i++)n.push(e.slice(4*i,4*(i+1)));return n.map(function(t,e){return o.DOM.tr({key:"row"+e},t)})},renderMonth:function(t){var e=p.month(t),r=["dp-cell dp-month"],n=+t;return n==this.props.moment&&r.push("dp-value"),o.DOM.td({key:e,className:r.join(" "),onClick:this.handleClick.bind(this,t)},e)},handleClick:function(t){event.target.value=t,(this.props.onSelect||n)(t,event)}});s({getHeaderText:function(t){return u(t).format("YYYY")}},d),t.exports=d}])});

@@ -29,2 +29,7 @@ 'use strict'

React.renderComponent(<App />, document.getElementById('content'))
if (React.createFactory){
DatePicker = React.createFactory(DatePicker)
App = React.createFactory(App)
}
;(React.render || React.renderComponent)(<App />, document.getElementById('content'))

@@ -16,2 +16,8 @@ 'use strict'

// if (React.createFactory){
// MonthView = React.createFactory(MonthView)
// YearView = React.createFactory(YearView)
// DecadeView = React.createFactory(DecadeView)
// }
var Views = {

@@ -71,2 +77,13 @@ month : MonthView,

getViewFactory: function() {
var view = this.getView()
if (React.createFactory){
view.__factory = view.__factory || React.createFactory(view)
view = view.__factory
}
return view
},
getViewDate: function() {

@@ -80,3 +97,3 @@ return this.state.viewMoment || this.props.viewDate || this.props.date || this.now

var view = this.getView()
var view = this.getViewFactory()
var props = asConfig(this.props)

@@ -106,2 +123,6 @@

renderFooter: function() {
if (this.props.hideFooter){
return
}
var todayText = this.props.today || 'Today'

@@ -108,0 +129,0 @@ var gotoSelected = this.props.gotoSelected || 'Go to selected'

{
"name": "react-date-picker",
"version": "1.0.3",
"version": "1.1.0",
"description": "React Date Picker",

@@ -27,3 +27,3 @@ "main": "lib/index.js",

"normalize.css": "~3.0.2",
"react": "~0.11.2"
"react": "0.11.2"
},

@@ -30,0 +30,0 @@ "devDependencies": {

@@ -14,4 +14,12 @@ react-date-picker

##### NOTE: Don't forget to include index.css or index.styl! ( require('react-date-picker/index.css') )
### NOTES:
Don't forget to include index.css or index.styl! ( require('react-date-picker/index.css') )
Also you need to have `React` included in the page.
`react-date-picker` works with both React 0.11.2 and the newer 0.12
### Example
```jsx

@@ -18,0 +26,0 @@ var date = '2014-10-10' //or Date.now()

@@ -16,2 +16,8 @@ 'use strict'

// if (React.createFactory){
// MonthView = React.createFactory(MonthView)
// YearView = React.createFactory(YearView)
// DecadeView = React.createFactory(DecadeView)
// }
var Views = {

@@ -71,2 +77,13 @@ month : MonthView,

getViewFactory: function() {
var view = this.getView()
if (React.createFactory){
view.__factory = view.__factory || React.createFactory(view)
view = view.__factory
}
return view
},
getViewDate: function() {

@@ -80,3 +97,3 @@ return this.state.viewMoment || this.props.viewDate || this.props.date || this.now

var view = this.getView()
var view = this.getViewFactory()
var props = asConfig(this.props)

@@ -83,0 +100,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc