react-time-picker
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -13,3 +13,4 @@ module.exports = { | ||
externals: { | ||
'react': 'React' | ||
'react': 'React', | ||
'moment': 'moment' | ||
}, | ||
@@ -16,0 +17,0 @@ resolve: { |
@@ -13,3 +13,4 @@ module.exports = { | ||
externals: { | ||
'react': 'React' | ||
'react': 'React', | ||
'moment': 'moment' | ||
}, | ||
@@ -16,0 +17,0 @@ resolve: { |
@@ -60,4 +60,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var React = __webpack_require__(1) | ||
var assign = __webpack_require__(6) | ||
var normalize = __webpack_require__(9) | ||
var assign = __webpack_require__(9) | ||
var normalize = __webpack_require__(12) | ||
@@ -69,15 +69,13 @@ var parseTime = __webpack_require__(2) | ||
var hasTouch = __webpack_require__(8) | ||
var EVENT_NAMES = __webpack_require__(7) | ||
var hasTouch = __webpack_require__(10) | ||
var EVENT_NAMES = __webpack_require__(11) | ||
var WHITESPACE = '\u00a0' | ||
function twoDigits(value){ | ||
return value < 10? | ||
'0' + value: | ||
value | ||
} | ||
function emptyFn(){} | ||
var twoDigits = __webpack_require__(6) | ||
var getFormatInfo = __webpack_require__(7) | ||
var format = __webpack_require__(8) | ||
module.exports = React.createClass({ | ||
@@ -114,4 +112,4 @@ | ||
hourStep: null, | ||
minuteStep: 10, | ||
secondStep: 30, | ||
minuteStep: 1, | ||
secondStep: 20, | ||
@@ -121,4 +119,2 @@ stepDelay:60, | ||
// showMinute: true, | ||
// showSecond: true, | ||
defaultStyle: { | ||
@@ -190,3 +186,3 @@ border: '1px solid gray', | ||
var separator = props.separator || React.createElement("span", {style: props.separatorStyle}, WHITESPACE + ':' + WHITESPACE) | ||
var hourSeparator = props.hourSeparator || separator | ||
var hourSeparator = hour && (minute || second || meridian)? props.hourSeparator || separator: null | ||
var minuteSeparator = minute && (second || meridian)? props.minuteSeparator || separator: null | ||
@@ -244,3 +240,11 @@ var secondSeparator = (second && meridian)? props.secondSeparator || separator: null | ||
onArrowMeridianAction: function(props, dir, name){ | ||
this.updateValue(name, this.time.meridian == 'AM'? 'PM': 'AM') | ||
var currentMeridian = this.time.meridian | ||
var lowercase = currentMeridian == 'am' || currentMeridian == 'pm' | ||
var newValue = lowercase? | ||
currentMeridian == 'am'? 'pm': 'am' | ||
: | ||
currentMeridian == 'AM'? 'PM': 'AM' | ||
this.updateValue(name, newValue) | ||
}, | ||
@@ -313,3 +317,3 @@ | ||
if (name != 'meridian'){ | ||
formatFn = props['format' + toUpperFirst(name)] || props.format | ||
formatFn = props['format' + toUpperFirst(name)] | ||
} else { | ||
@@ -319,4 +323,10 @@ formatFn = props.formatMeridian | ||
if (!formatFn && typeof props.format == 'string'){ | ||
formatFn = function(value, name){ | ||
return format(name, value, props.formatInfo) | ||
} | ||
} | ||
if (typeof formatFn == 'function'){ | ||
value = formatFn(value) | ||
value = formatFn(value, name, props) | ||
} | ||
@@ -444,6 +454,14 @@ | ||
props.showSecond = timeValue.second !== undefined | ||
props.showMinute = timeValue.minute !== undefined | ||
props.withMeridian = timeValue.meridian != null | ||
props.showSecond = props.formatInfo? | ||
props.formatInfo.second.specified: | ||
timeValue.second !== undefined | ||
props.showMinute = props.formatInfo? | ||
props.formatInfo.minute.specified: | ||
timeValue.minute !== undefined | ||
props.withMeridian = props.formatInfo? | ||
props.formatInfo.meridian.specified: | ||
timeValue.meridian != null | ||
return timeValue | ||
@@ -485,2 +503,3 @@ }, | ||
props.formatInfo = getFormatInfo(props.format) | ||
this.time = props.time = this.prepareTime(props, state) | ||
@@ -587,3 +606,3 @@ this.prepareStyles(props, state) | ||
var parseTime = __webpack_require__(14) | ||
var parseTime = __webpack_require__(17) | ||
var adjustOverflow = parseTime.adjustOverflow | ||
@@ -683,3 +702,3 @@ | ||
var update = __webpack_require__(14).updateTime | ||
var update = __webpack_require__(17).updateTime | ||
@@ -740,2 +759,153 @@ module.exports = function(time, name, value, config){ | ||
module.exports = function twoDigits(value){ | ||
return value < 10? | ||
'0' + value: | ||
value | ||
} | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
function getHourInfo(format, value){ | ||
var len = 1 | ||
var specified = false | ||
var index = format.indexOf('h') | ||
if (~index){ | ||
specified = true | ||
if (format.charAt(index + 1) == 'h'){ | ||
len++ | ||
} | ||
} else { | ||
index = format.indexOf('H') | ||
if (~index){ | ||
specified = true | ||
if (format.charAt(index + 1) == 'H'){ | ||
len++ | ||
} | ||
} | ||
} | ||
return { | ||
len: len, | ||
specified: specified | ||
} | ||
} | ||
function getMinuteInfo(format, value){ | ||
var len = 1 | ||
var specified = false | ||
var index = format.indexOf('m') | ||
if (~index){ | ||
specified = true | ||
if (format.charAt(index+1) == 'm'){ | ||
len++ | ||
} | ||
} | ||
return { | ||
len: len, | ||
specified: specified | ||
} | ||
} | ||
function getSecondInfo(format, value){ | ||
var len = 1 | ||
var specified = false | ||
var index = format.indexOf('s') | ||
if (~index){ | ||
specified = true | ||
if (format.charAt(index+1) == 's'){ | ||
len++ | ||
} | ||
} | ||
return { | ||
len: len, | ||
specified: specified | ||
} | ||
} | ||
function isMeridianUpperCase(format, value){ | ||
var uppercase = true | ||
var specified = false | ||
var index = format.indexOf('a') | ||
if (~index){ | ||
specified = true | ||
uppercase = false | ||
} else if (~format.indexOf('A')){ | ||
specified = true | ||
} | ||
return { | ||
uppercase: uppercase, | ||
lowercase: !uppercase, | ||
specified: specified | ||
} | ||
} | ||
module.exports = function(format){ | ||
if (typeof format != 'string'){ | ||
return | ||
} | ||
return { | ||
hour : getHourInfo(format), | ||
minute : getMinuteInfo(format), | ||
second : getSecondInfo(format), | ||
meridian: isMeridianUpperCase(format) | ||
} | ||
} | ||
/***/ }, | ||
/* 8 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var twoDigits = __webpack_require__(6) | ||
var getFormatInfo = __webpack_require__(7) | ||
module.exports = function(name, value, formatOrInfo){ | ||
var formatInfo = formatOrInfo | ||
if (!formatInfo || !formatInfo.hour || typeof formatInfo == 'string'){ | ||
formatInfo = getFormatInfo(formatInfo) | ||
} | ||
if (!formatInfo){ | ||
return '' | ||
} | ||
var info = formatInfo[name] | ||
if (name === 'meridian' && info.specified){ | ||
return info.uppercase? value.toUpperCase(): value.toLowerCase() | ||
} | ||
return info.specified? | ||
info.len == 2? | ||
twoDigits(value): | ||
value | ||
: | ||
'' | ||
} | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
function ToObject(val) { | ||
@@ -768,8 +938,15 @@ if (val == null) { | ||
/***/ }, | ||
/* 7 */ | ||
/* 10 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(global) {module.exports = 'ontouchstart' in global || (global.DocumentTouch && document instanceof DocumentTouch) | ||
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) | ||
/***/ }, | ||
/* 11 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
module.exports = __webpack_require__(8)? | ||
module.exports = __webpack_require__(10)? | ||
{ | ||
@@ -787,19 +964,12 @@ onMouseDown: 'onTouchStart', | ||
/***/ }, | ||
/* 8 */ | ||
/* 12 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(global) {module.exports = 'ontouchstart' in global || (global.DocumentTouch && document instanceof DocumentTouch) | ||
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var hasOwn = __webpack_require__(10) | ||
var getPrefixed = __webpack_require__(11) | ||
var hasOwn = __webpack_require__(13) | ||
var getPrefixed = __webpack_require__(14) | ||
var map = __webpack_require__(12) | ||
var plugable = __webpack_require__(13) | ||
var map = __webpack_require__(15) | ||
var plugable = __webpack_require__(16) | ||
@@ -864,3 +1034,3 @@ function plugins(key, value){ | ||
/***/ }, | ||
/* 10 */ | ||
/* 13 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -876,3 +1046,3 @@ | ||
/***/ }, | ||
/* 11 */ | ||
/* 14 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -882,4 +1052,4 @@ | ||
var getStylePrefixed = __webpack_require__(16) | ||
var properties = __webpack_require__(17) | ||
var getStylePrefixed = __webpack_require__(19) | ||
var properties = __webpack_require__(20) | ||
@@ -896,3 +1066,3 @@ module.exports = function(key, value){ | ||
/***/ }, | ||
/* 12 */ | ||
/* 15 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -918,3 +1088,3 @@ | ||
/***/ }, | ||
/* 13 */ | ||
/* 16 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -924,3 +1094,3 @@ | ||
var getCssPrefixedValue = __webpack_require__(15) | ||
var getCssPrefixedValue = __webpack_require__(18) | ||
@@ -956,3 +1126,3 @@ module.exports = function(target){ | ||
/***/ }, | ||
/* 14 */ | ||
/* 17 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -962,4 +1132,4 @@ | ||
var assign = __webpack_require__(30) | ||
var defaults = __webpack_require__(18) | ||
var assign = __webpack_require__(34) | ||
var defaults = __webpack_require__(21) | ||
@@ -970,6 +1140,6 @@ function trim(str){ | ||
var validHour = __webpack_require__(19) | ||
var validMinute = __webpack_require__(20) | ||
var validSecond = __webpack_require__(21) | ||
var validMeridian = __webpack_require__(22) | ||
var validHour = __webpack_require__(22) | ||
var validMinute = __webpack_require__(23) | ||
var validSecond = __webpack_require__(24) | ||
var validMeridian = __webpack_require__(25) | ||
@@ -1136,6 +1306,6 @@ function getHour(value, config){ | ||
var isValidPart = __webpack_require__(23) | ||
var isValidTime = __webpack_require__(24) | ||
var updateTime = __webpack_require__(25) | ||
var adjustOverflow = __webpack_require__(26) | ||
var isValidPart = __webpack_require__(26) | ||
var isValidTime = __webpack_require__(27) | ||
var updateTime = __webpack_require__(28) | ||
var adjustOverflow = __webpack_require__(29) | ||
@@ -1150,3 +1320,3 @@ PARSE.isValidPart = isValidPart | ||
/***/ }, | ||
/* 15 */ | ||
/* 18 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1156,5 +1326,5 @@ | ||
var getPrefix = __webpack_require__(27) | ||
var forcePrefixed = __webpack_require__(28) | ||
var el = __webpack_require__(29) | ||
var getPrefix = __webpack_require__(30) | ||
var forcePrefixed = __webpack_require__(31) | ||
var el = __webpack_require__(32) | ||
@@ -1202,3 +1372,3 @@ var MEMORY = {} | ||
/***/ }, | ||
/* 16 */ | ||
/* 19 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1208,5 +1378,5 @@ | ||
var toUpperFirst = __webpack_require__(31) | ||
var getPrefix = __webpack_require__(27) | ||
var el = __webpack_require__(29) | ||
var toUpperFirst = __webpack_require__(33) | ||
var getPrefix = __webpack_require__(30) | ||
var el = __webpack_require__(32) | ||
@@ -1246,3 +1416,3 @@ var MEMORY = {} | ||
/***/ }, | ||
/* 17 */ | ||
/* 20 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1287,3 +1457,3 @@ | ||
/***/ }, | ||
/* 18 */ | ||
/* 21 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1299,3 +1469,3 @@ | ||
/***/ }, | ||
/* 19 */ | ||
/* 22 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1305,3 +1475,3 @@ | ||
var validNumber = __webpack_require__(32) | ||
var validNumber = __webpack_require__(35) | ||
@@ -1325,3 +1495,3 @@ module.exports = function validHour(value, config){ | ||
/***/ }, | ||
/* 20 */ | ||
/* 23 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1331,3 +1501,3 @@ | ||
var validNumber = __webpack_require__(32) | ||
var validNumber = __webpack_require__(35) | ||
@@ -1346,3 +1516,3 @@ module.exports = function validMinute(value, config){ | ||
/***/ }, | ||
/* 21 */ | ||
/* 24 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1352,3 +1522,3 @@ | ||
var validMinute = __webpack_require__(20) | ||
var validMinute = __webpack_require__(23) | ||
@@ -1360,3 +1530,3 @@ module.exports = function validSecond(value, config){ | ||
/***/ }, | ||
/* 22 */ | ||
/* 25 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1377,3 +1547,3 @@ | ||
/***/ }, | ||
/* 23 */ | ||
/* 26 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1383,6 +1553,6 @@ | ||
var validHour = __webpack_require__(19) | ||
var validMinute = __webpack_require__(20) | ||
var validSecond = __webpack_require__(21) | ||
var validMeridian = __webpack_require__(22) | ||
var validHour = __webpack_require__(22) | ||
var validMinute = __webpack_require__(23) | ||
var validSecond = __webpack_require__(24) | ||
var validMeridian = __webpack_require__(25) | ||
@@ -1432,3 +1602,3 @@ var VALIDATION_MAP = { | ||
/***/ }, | ||
/* 24 */ | ||
/* 27 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1438,4 +1608,4 @@ | ||
var isValidPart = __webpack_require__(23) | ||
var assign = __webpack_require__(30) | ||
var isValidPart = __webpack_require__(26) | ||
var assign = __webpack_require__(34) | ||
@@ -1467,3 +1637,3 @@ module.exports = function isValidTime(time, config){ | ||
/***/ }, | ||
/* 25 */ | ||
/* 28 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1473,9 +1643,9 @@ | ||
var assign = __webpack_require__(30) | ||
var isValidNumber = __webpack_require__(32) | ||
var isValidPart = __webpack_require__(23) | ||
var isValidTime = __webpack_require__(24) | ||
var adjustOverflow = __webpack_require__(26) | ||
var assign = __webpack_require__(34) | ||
var isValidNumber = __webpack_require__(35) | ||
var isValidPart = __webpack_require__(26) | ||
var isValidTime = __webpack_require__(27) | ||
var adjustOverflow = __webpack_require__(29) | ||
var clamp = __webpack_require__(33) | ||
var clamp = __webpack_require__(36) | ||
@@ -1531,3 +1701,3 @@ /** | ||
/***/ }, | ||
/* 26 */ | ||
/* 29 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1658,3 +1828,3 @@ | ||
/***/ }, | ||
/* 27 */ | ||
/* 30 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1664,6 +1834,6 @@ | ||
var toUpperFirst = __webpack_require__(31) | ||
var toUpperFirst = __webpack_require__(33) | ||
var prefixes = ["ms", "Moz", "Webkit", "O"] | ||
var el = __webpack_require__(29) | ||
var el = __webpack_require__(32) | ||
@@ -1694,3 +1864,3 @@ var PREFIX | ||
/***/ }, | ||
/* 28 */ | ||
/* 31 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1700,5 +1870,5 @@ | ||
var toUpperFirst = __webpack_require__(31) | ||
var getPrefix = __webpack_require__(27) | ||
var properties = __webpack_require__(17) | ||
var toUpperFirst = __webpack_require__(33) | ||
var getPrefix = __webpack_require__(30) | ||
var properties = __webpack_require__(20) | ||
@@ -1725,3 +1895,3 @@ /** | ||
/***/ }, | ||
/* 29 */ | ||
/* 32 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1741,3 +1911,3 @@ | ||
/***/ }, | ||
/* 30 */ | ||
/* 33 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1747,2 +1917,14 @@ | ||
module.exports = function(str){ | ||
return str? | ||
str.charAt(0).toUpperCase() + str.slice(1): | ||
'' | ||
} | ||
/***/ }, | ||
/* 34 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
function ToObject(val) { | ||
@@ -1775,3 +1957,3 @@ if (val == null) { | ||
/***/ }, | ||
/* 31 */ | ||
/* 35 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1781,17 +1963,5 @@ | ||
module.exports = function(str){ | ||
return str? | ||
str.charAt(0).toUpperCase() + str.slice(1): | ||
'' | ||
} | ||
var assign = __webpack_require__(34) | ||
var defaults = __webpack_require__(21) | ||
/***/ }, | ||
/* 32 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var assign = __webpack_require__(30) | ||
var defaults = __webpack_require__(18) | ||
module.exports = function validNumber(n, config){ | ||
@@ -1819,3 +1989,3 @@ var valid = !isNaN(n * 1) | ||
/***/ }, | ||
/* 33 */ | ||
/* 36 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1822,0 +1992,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define(["React"],e):"object"==typeof exports?exports.ReactTimePicker=e(require("React")):t.ReactTimePicker=e(t.React)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}(function(t){for(var e in t)switch(typeof t[e]){case"number":t[e]=t[t[e]];break;case"object":t[e]=function(e){var n=e.slice(1),r=t[e[0]];return function(t,e,i){r.apply(null,[t,e,i].concat(n))}}(t[e])}return t}([function(t,e,n){"use strict";function r(t){return 10>t?"0"+t:t}function i(){}var o=n(33),u=n(19),a=n(26),s=n(29),l=n(32),c=n(31),p=n(30),d=n(15),f=n(20),h=" ";t.exports=o.createClass({displayName:"ReactTimePicker",componentWillUnmount:function(){this.stopInterval()},getInitialState:function(){return{defaultValue:this.props.defaultValue,focused:{hour:null,minute:null,second:null,meridian:null}}},getDefaultProps:function(){return{stopChangePropagation:!0,strict:!0,overflowHourToMeridian:!0,step:1,hourStep:null,minuteStep:10,secondStep:30,stepDelay:60,showArrows:!0,defaultStyle:{border:"1px solid gray",padding:20,display:"inline-flex",alignItems:"center",boxSizing:"border-box",flexFlow:"row",width:200},defaultArrowStyle:{cursor:"pointer",userSelect:"none"},defaultBoxStyle:{boxSizing:"border-box",display:"flex",flexFlow:"column",alignItems:"center"},defaultInputStyle:{boxSizing:"border-box",width:"100%",textAlign:"center"},defaultSeparatorStyle:{flex:"none"},defaultMeridianInputStyle:{cursor:"pointer"},defaultMeridianInputProps:{readOnly:!0},format:r,formatHour:null,formatMinute:null,formatSecond:null,formatMeridian:null,defaultArrowFactory:o.DOM.span,arrowFactory:null,arrowUpFactory:null,arrowDownFactory:null,defaultInputFactory:o.DOM.input,inputFactory:null,hourInputFactory:null,minuteInputFactory:null,secondInputFactory:null,meridianInputFactory:null,timeToString:p}},render:function(){var t=this.prepareProps(this.props,this.state),e=this.renderHour(t),n=this.renderMinute(t),r=this.renderSecond(t),i=this.renderMeridian(t),u=t.separator||o.createElement("span",{style:t.separatorStyle},h+":"+h),a=t.hourSeparator||u,s=n&&(r||i)?t.minuteSeparator||u:null,l=r&&i?t.secondSeparator||u:null;return o.createElement("div",o.__spread({},t),e,a,n,s,r,l,i)},onArrowMouseDown:function(t,e,n,r){if("meridian"==n)return void this.onArrowMeridianAction(t,e,n);var i=d?r.target:window,o=d?"touchend":"click";i.addEventListener(o,this.onWindowClick),this.startInterval(t,e,n)},onWindowClick:function(){this.stopInterval()},stopInterval:function(){clearInterval(this.intervalId)},startInterval:function(t,e,n){this.intervalId=setInterval(function(){this.onArrowAction(t,e,n)}.bind(this),t.stepDelay)},onMeridianInputMouseDown:function(t,e){e.preventDefault(),this.onArrowMeridianAction(t,1,"meridian")},onArrowMeridianAction:function(t,e,n){this.updateValue(n,"AM"==this.time.meridian?"PM":"AM")},onArrowAction:function(t,e,n){var r=1==e?"Up":"Down",i="onArrow"+r+c(n)+"Action";"function"==typeof this[i]&&this[i](t),i="onArrow"+c(n)+"Action","function"==typeof this[i]&&this[i](t,e),this.incValue(t,n,e)},incValue:function(t,e,n){n=n||0;var r=t[e+"Step"]||t.step,i=n*r,o=this.time,u=o[e],a=u+i;this.setValue(o),this.updateValue(e,a)},updateValue:function(t,e,n){this.setValue(this.updateTime(t,e,n))},updateTime:function(t,e,n){n=n||{},n.overflowHourToMeridian=this.props.overflowHourToMeridian;var r=this.time;return r=l(r,t,e,n),this.time=r},setValue:function(t){null==this.props.value&&this.setState({defaultValue:t}),(this.props.onChange||i)(this.props.timeToString(t),u({},t))},format:function(t,e,n){var r;return arguments.length<3&&(n=t.time[e]),r="meridian"!=e?t["format"+c(e)]||t.format:t.formatMeridian,"function"==typeof r&&(n=r(n)),n},renderBox:function(t,e){var n,r=this.state,i=t[e+"Style"],a=t[e+"InputStyle"],s=c(e);n=r.focused[e]?r.focused[e].value:this.format(t,e);var l,p;if(t.showArrows){var d={style:t.arrowUpStyle,children:"▴"};d[f.onMouseDown]=this.onArrowMouseDown.bind(this,t,1,e);var h={style:t.arrowDownStyle,children:"▾"};h[f.onMouseDown]=this.onArrowMouseDown.bind(this,t,-1,e);var v=t.defaultArrowFactory,m=t.arrowUpFactory||t.arrowFactory||v,y=t.arrowDownFactory||t.arrowFactory||v;l=m(d),void 0===l&&(l=v(d)),p=y(h),void 0===p&&(p=v(h))}var S=t.defaultInputFactory,w=t[e+"InputFactory"]||t.inputFactory||S,M=t["default"+s+"InputProps"],x=u({},M,{style:a,value:n,onFocus:this.handleInputFocus.bind(this,t,e),onBlur:this.handleInputBlur.bind(this,t,e),onChange:this.handleInputChange.bind(this,t,e)});"meridian"==e&&(x.onMouseDown=this.onMeridianInputMouseDown.bind(this,t));var g=w(x);return void 0===g&&(g=S(x)),o.createElement("div",{style:i},l,g,p)},handleInputFocus:function(t,e){var n=this.state.focused;n[e]={value:this.format(t,e)},this.setState({})},handleInputBlur:function(t,e,n){this.state.focused[e]=null,this.setState({});var r=1*n.target.value;this.updateValue(e,r,{clamp:t.clamp})},handleInputChange:function(t,e,n){this.state.focused[e]&&(this.state.focused[e].value=n.target.value),this.setState({}),t.stopChangePropagation&&n.stopPropagation()},getTime:function(){return s(this.getValue(),{strict:this.props.strict})},prepareTime:function(t){var e=this.getTime();return t.showSecond=void 0!==e.second,t.showMinute=void 0!==e.minute,t.withMeridian=null!=e.meridian,e},getValue:function(){var t=null==this.props.value?this.state.defaultValue:this.props.value;return t},renderHour:function(t){return this.renderBox(t,"hour")},renderMinute:function(t){return t.showMinute?this.renderBox(t,"minute"):void 0},renderSecond:function(t){return t.showSecond?this.renderBox(t,"second"):void 0},renderMeridian:function(t){return t.withMeridian?this.renderBox(t,"meridian"):void 0},prepareProps:function(t,e){var n=u({},t);return this.time=n.time=this.prepareTime(n,e),this.prepareStyles(n,e),n},prepareStyles:function(t,e){t.style=this.prepareStyle(t,e),t.separatorStyle=this.prepareSeparatorStyle(t,e),this.prepareArrowStyles(t,e),this.prepareHourStyles(t,e),this.prepareMinuteStyles(t,e),this.prepareSecondStyles(t,e),this.prepareMeridianStyles(t,e)},prepareStyle:function(t){return a(u({},t.defaultStyle,t.style))},prepareSeparatorStyle:function(t){return a(u({},t.defaultSeparatorStyle,t.separatorStyle))},prepareArrowStyles:function(t){t.arrowUpStyle=a(u({},t.defaultArrowStyle,t.defaultArrowUpStyle,t.arrowUpStyle)),t.arrowDownStyle=a(u({},t.defaultArrowStyle,t.defaultArrowDownStyle,t.arrowDownStyle))},prepareHourStyles:function(t,e){t.hourStyle=this.prepareHourStyle(t,e),t.hourInputStyle=this.prepareHourInputStyle(t,e)},prepareHourStyle:function(t){return a(u({},t.defaultBoxStyle,t.defaultHourStyle,t.hourStyle))},prepareHourInputStyle:function(t){return a(u({},t.defaultInputStyle,t.defaultHourInputStyle,t.hourInputStyle))},prepareMinuteStyles:function(t,e){t.minuteStyle=this.prepareMinuteStyle(t,e),t.minuteInputStyle=this.prepareMinuteInputStyle(t,e)},prepareMinuteStyle:function(t){return a(u({},t.defaultBoxStyle,t.defaultMinuteStyle,t.minuteStyle))},prepareMinuteInputStyle:function(t){return a(u({},t.defaultInputStyle,t.defaultMinuteInputStyle,t.minuteInputStyle))},prepareSecondStyles:function(t,e){t.showSecond&&(t.secondStyle=this.prepareSecondStyle(t,e),t.secondInputStyle=this.prepareSecondInputStyle(t,e))},prepareSecondStyle:function(t){return a(u({},t.defaultBoxStyle,t.defaultSecondStyle,t.secondStyle))},prepareSecondInputStyle:function(t){return a(u({},t.defaultInputStyle,t.defaultSecondInputStyle,t.secondInputStyle))},prepareMeridianStyles:function(t,e){t.withMeridian&&(t.meridianStyle=this.prepareMeridianStyle(t,e),t.meridianInputStyle=this.prepareMeridianInputStyle(t,e))},prepareMeridianStyle:function(t){return a(u({},t.defaultBoxStyle,t.defaultMeridianStyle,t.meridianStyle))},prepareMeridianInputStyle:function(t){return a(u({},t.defaultInputStyle,t.defaultMeridianInputStyle,t.meridianInputStyle))}})},function(t){"use strict";function e(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t){for(var n,r,i=e(t),o=1;o<arguments.length;o++){n=arguments[o],r=Object.keys(Object(n));for(var u=0;u<r.length;u++)i[r[u]]=n[r[u]]}return i}},function(t,e,n){"use strict";var r=n(12),i=n(3),o=n(14),u=n(13),a={hour:r,minute:i,second:o,meridian:u};t.exports=function(t,e,n){var r=a[t];return!(!r||!r(e,n))}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e){return r(t,e)?(t*=1,t>=0&&60>t):!1}},function(t,e,n){"use strict";var r=n(1),i=n(9);t.exports=function(t,e){var n=!isNaN(1*t);return e=e?r({},i,e):i,n&&"string"==typeof t&&e.twoDigits&&(n=2==t.length),n&&(t=1*t,n=parseInt(t)===t),n}},function(t,e){(function(e){"use strict";var n;e.document&&(n=e.document.createElement("div")),t.exports=n}).call(e,function(){return this}())},function(t,e,n){"use strict";var r,i=n(7),o=["ms","Moz","Webkit","O"],u=n(5);t.exports=function(t){if(r)return r;for(var e,n,a=0,s=o.length;s>a;a++)if(n=o[a],e=n+i(t),"undefined"!=typeof u.style[e])return r=n}},function(t){"use strict";t.exports=function(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}},function(t){"use strict";function e(t,e,n,r){if(void 0!==t.hour){var i=!r||r.overflowHourToMeridian!==!1,o=t.meridian||r&&r.meridian,u=o?12:23,a=o?12:24,s=0;n>u&&(s+=Math.floor(n/u),n%=a),0>n&&(s=Math.ceil(-n/u),n=a+n),o&&n===u&&(t.minute>0||t.second>0)&&(s+=1,n=0),o&&s%2==1&&i&&("string"==typeof o&&(o=o.toUpperCase()),t.meridian="PM"==o?"AM":"PM"),t.hour=n}}function n(t,e,n,r,i){if(void 0!==t[e]){var o=0;n>59&&(o+=Math.floor(n/60),n%=60),0>n&&(o-=Math.ceil(-n/60),n=60+n),t[e||"minute"]=n,o&&(t[i||"hour"]+=o)}}function r(t,r,i,o){n(t,"minute",t.minute,o),e(t,"hour",t.hour,o)}function i(t,e,i,o){n(t,"second",t.second,o,"minute"),r(t,"minute",t.minute,o)}var o={},u={hour:e,minute:r,second:i};t.exports=function(t,e,n,r){return 2==arguments.length&&(r=e,e="second",n=t[e]),u[e](t,e,n,r||o),t}},function(t){"use strict";t.exports={separator:":",twoDigits:!0}},function(t,e,n){"use strict";function r(t){return t.trim()}function i(t,e){return h(t,e)?1*t:void 0}function o(t){return v(t)?1*t:void 0}function u(t){return m(t)?1*t:void 0}function a(t){return y(t)?t:void 0}function s(t){var e=t.split(" ");return e.length>1}function l(t){return S[t]}function c(t,e,n){var i,o,u=n&&n.meridian,s=t.split(" ").map(r),c=l(e),p={invalid:[]};return w(e,s[0],n)?c&&(i=c(s[0],n)):p.invalid.push({name:e,value:s[0]}),u&&(o=a(s[1]),void 0===o&&p.invalid.push({name:"meridian",value:s[1]})),void 0!==o&&(p.meridian=o),void 0!==i&&(p[e]=i),p}function p(t,e){e=d({},f,e);var n=t.split(e.separator).map(r),u=s(n[n.length-1]);e.meridian=u;var a,l,p=[],h={};return n.length>3?void 0:(1==n.length&&d(h,c(n[0],"hour",e)),2==n.length&&(a=i(n[0],e),void 0===a&&p.push({name:"hour",value:n[0]}),d(h,c(n[1],"minute",e))),3==n.length&&(a=i(n[0],e),l=o(n[1]),void 0===a&&p.push({name:"hour",value:n[0]}),void 0===l&&p.push({name:"minute",value:n[1]}),d(h,c(n[2],"second",e))),h.invalid&&(p.push.apply(p,h.invalid),h.invalid=p),void 0!==a&&(h.hour=a),void 0!==l&&(h.minute=l),h.invalid.length||delete h.invalid,h)}var d=n(1),f=n(9),h=n(12),v=n(3),m=n(14),y=n(13),S={hour:i,minute:o,second:u,meridian:a},w=n(2),M=n(11),x=n(18),g=n(8);p.isValidPart=w,p.isValidTime=M,p.updateTime=x,p.adjustOverflow=g,t.exports=p},function(t,e,n){"use strict";var r=n(2),i=n(1);t.exports=function(t,e){var n=void 0===t.second||r("second",t.second,e),o=n&&(void 0===t.minute||r("minute",t.minute,e)),u=o&&r("hour",t.hour,i({meridian:t.meridian},e)),a=t.meridian,s=u&&(a?r("meridian",a,e):!0),l=s;if(l&&a){var c=1*t.hour;12===c&&(l=1*t.minute===0&&1*t.second===0)}return l}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e){var n=e&&e.meridian;return r(t,e)?(t*=1,n?t>=0&&12>=t:t>=0&&24>t):!1}},function(t){"use strict";t.exports=function(t){return t?(t=t.toUpperCase(),"AM"==t||"PM"==t):!1}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e){return r(t,e)}},function(t,e){(function(e){t.exports="ontouchstart"in e||e.DocumentTouch&&document instanceof DocumentTouch}).call(e,function(){return this}())},function(t){"use strict";t.exports={alignItems:1,justifyContent:1,flex:1,flexFlow:1,userSelect:1,transform:1,transition:1,transformOrigin:1,transformStyle:1,transitionProperty:1,transitionDuration:1,transitionTimingFunction:1,transitionDelay:1,borderImage:1,borderImageSlice:1,boxShadow:1,backgroundClip:1,backfaceVisibility:1,perspective:1,perspectiveOrigin:1,animation:1,animationDuration:1,animationName:1,animationDelay:1,animationDirection:1,animationIterationCount:1,animationTimingFunction:1,animationPlayState:1,animationFillMode:1,appearance:1}},function(t){"use strict";t.exports=function(t,e,n){if("meridian"==e)return n;if("hour"==e){var r=24;return t.meridian&&(r=t.hour||t.minute?11:12),0>n?0:n>r?r:n}return 0>n?0:n>59?59:n}},function(t,e,n){"use strict";var r=n(1),i=n(4),o=n(2),u=n(11),a=n(8),s=n(17);t.exports=function(t,e,n,l){var c=t,p=i(n,l),d=o(e,n,l);if(t=r({},t),l=l||{},p&&(n*=1),(d||p)&&(t[e]=n),!u(t,l)&&l.clamp&&(t[e]=s(t,e,t[e])),!u(t,l)){if(l.rejectInvalid)return c;l.overflow!==!1&&(t=a(t,l))}return t}},1,function(t,e,n){"use strict";t.exports=n(15)?{onMouseDown:"onTouchStart",onMouseUp:"onTouchEnd",onMouseMove:"onTouchMove"}:{onMouseDown:"onMouseDown",onMouseUp:"onMouseUp",onMouseMove:"onMouseMove"}},function(t,e,n){"use strict";var r=n(7),i=n(6),o=n(16);t.exports=function(t){if(!o[t])return t;var e=i(t);return e?e+r(t):t}},function(t,e,n){"use strict";var r=n(6),i=n(21),o=n(5),u={},a=o.style;t.exports=function(t,e){var n=t+": "+e;if(u[n])return u[n];var s,l,c;return t in a||(s=r("appearance"),s&&(l=i(t,e),c="-"+s.toLowerCase()+"-"+e,l in a&&(o.style[l]="",o.style[l]=c,""!==o.style[l]&&(e=c)))),u[n]=e,e}},function(t,e,n){"use strict";var r=n(24),i=n(16);t.exports=function(t,e){return i[t]?r(t,e):t}},function(t,e,n){"use strict";var r=n(7),i=n(6),o=n(5),u={},a=o.style;t.exports=function(t){var e=t;if(u[e])return u[e];var n,o;return t in a||(n=i("appearance"),n&&(o=n+r(t),o in a&&(t=o))),u[e]=t,t}},function(t){"use strict";t.exports=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";function r(t,e){var n={key:t,value:e};return(l.plugins||[]).forEach(function(r){var i=a(function(n){return r(t,e,n)},n);i&&(n=i)}),n}function i(t,e){var n=r(t,e);return a(function(t){return{key:u(t.key,t.value),value:t.value}},n)}var o=n(25),u=n(23),a=n(27),s=n(28),l=function(t){var e,n,r={};for(e in t)if(o(t,e)){if(n=i(e,t[e]),!n)continue;a(function(t){r[t.key]=t.value},n)}return r};t.exports=s(l)},function(t){"use strict";t.exports=function(t,e){return e?Array.isArray(e)?e.map(t).filter(function(t){return!!t}):t(e):void 0}},function(t,e,n){"use strict";var r=n(22);t.exports=function(t){return t.plugins=t.plugins||[function(){var t={flex:1,"inline-flex":1};return function(e,n){return"display"===e&&n in t?{key:e,value:r(e,n)}:void 0}}()],t.plugin=function(e){t.plugins=t.plugins||[],t.plugins.push(e)},t}},function(t,e,n){"use strict";function r(t,e){return t.invalid.forEach(function(e){var n=e.name,r=1*e.value;isNaN(r)||(t[n]=r)}),o(t,e)}var i=n(10),o=i.adjustOverflow,u={};t.exports=function(t,e){e=e||u,t=t||"","string"==typeof t&&(t=i(t));var n={};t&&(e.withMeridian=null!=t.meridian,t.invalid&&t.invalid.forEach(function(t){n[t.name]=!0}),!e.strict&&t.invalid&&(t=r(t,e)),n.hour&&(t.hour=t.hour||0),n.minute&&(t.minute=t.minute||0),n.second&&(t.second=t.second||0),e.strict&&t.meridian&&12===t.hour&&(void 0!==t.minute&&(t.minute=0),void 0!==t.second&&(t.second=0)));var o={hour:t.hour};return void 0!==t.minute&&(o.minute=t.minute),void 0!==t.second&&(o.second=t.second),e.withMeridian&&(o.meridian=t.meridian),o}},function(t){"use strict";function e(t){return 10>t?"0"+t:t}t.exports=function(t){var n=e(t.hour);return null!=t.minute&&(n+=":"+e(t.minute)),null!=t.second&&(n+=":"+e(t.second)),t.meridian&&(n+=" "+t.meridian),n}},7,function(t,e,n){"use strict";var r=n(10).updateTime;t.exports=function(t,e,n,i){return t=r(t,e,n,i)}},function(e){e.exports=t}]))}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define(["React"],e):"object"==typeof exports?exports.ReactTimePicker=e(require("React")):t.ReactTimePicker=e(t.React)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}(function(t){for(var e in t)switch(typeof t[e]){case"number":t[e]=t[t[e]];break;case"object":t[e]=function(e){var n=e.slice(1),r=t[e[0]];return function(t,e,i){r.apply(null,[t,e,i].concat(n))}}(t[e])}return t}([function(t,e,n){"use strict";function r(){}var i=n(36),o=n(21),u=n(28),a=n(32),s=n(35),c=n(34),l=n(33),p=n(15),f=n(22),d=" ",h=n(18),m=n(17),v=n(31);t.exports=i.createClass({displayName:"ReactTimePicker",componentWillUnmount:function(){this.stopInterval()},getInitialState:function(){return{defaultValue:this.props.defaultValue,focused:{hour:null,minute:null,second:null,meridian:null}}},getDefaultProps:function(){return{stopChangePropagation:!0,strict:!0,overflowHourToMeridian:!0,step:1,hourStep:null,minuteStep:1,secondStep:20,stepDelay:60,showArrows:!0,defaultStyle:{border:"1px solid gray",padding:20,display:"inline-flex",alignItems:"center",boxSizing:"border-box",flexFlow:"row",width:200},defaultArrowStyle:{cursor:"pointer",userSelect:"none"},defaultBoxStyle:{boxSizing:"border-box",display:"flex",flexFlow:"column",alignItems:"center"},defaultInputStyle:{boxSizing:"border-box",width:"100%",textAlign:"center"},defaultSeparatorStyle:{flex:"none"},defaultMeridianInputStyle:{cursor:"pointer"},defaultMeridianInputProps:{readOnly:!0},format:h,formatHour:null,formatMinute:null,formatSecond:null,formatMeridian:null,defaultArrowFactory:i.DOM.span,arrowFactory:null,arrowUpFactory:null,arrowDownFactory:null,defaultInputFactory:i.DOM.input,inputFactory:null,hourInputFactory:null,minuteInputFactory:null,secondInputFactory:null,meridianInputFactory:null,timeToString:l}},render:function(){var t=this.prepareProps(this.props,this.state),e=this.renderHour(t),n=this.renderMinute(t),r=this.renderSecond(t),o=this.renderMeridian(t),u=t.separator||i.createElement("span",{style:t.separatorStyle},d+":"+d),a=e&&(n||r||o)?t.hourSeparator||u:null,s=n&&(r||o)?t.minuteSeparator||u:null,c=r&&o?t.secondSeparator||u:null;return i.createElement("div",i.__spread({},t),e,a,n,s,r,c,o)},onArrowMouseDown:function(t,e,n,r){if("meridian"==n)return void this.onArrowMeridianAction(t,e,n);var i=p?r.target:window,o=p?"touchend":"click";i.addEventListener(o,this.onWindowClick),this.startInterval(t,e,n)},onWindowClick:function(){this.stopInterval()},stopInterval:function(){clearInterval(this.intervalId)},startInterval:function(t,e,n){this.intervalId=setInterval(function(){this.onArrowAction(t,e,n)}.bind(this),t.stepDelay)},onMeridianInputMouseDown:function(t,e){e.preventDefault(),this.onArrowMeridianAction(t,1,"meridian")},onArrowMeridianAction:function(t,e,n){var r=this.time.meridian,i="am"==r||"pm"==r,o=i?"am"==r?"pm":"am":"AM"==r?"PM":"AM";this.updateValue(n,o)},onArrowAction:function(t,e,n){var r=1==e?"Up":"Down",i="onArrow"+r+c(n)+"Action";"function"==typeof this[i]&&this[i](t),i="onArrow"+c(n)+"Action","function"==typeof this[i]&&this[i](t,e),this.incValue(t,n,e)},incValue:function(t,e,n){n=n||0;var r=t[e+"Step"]||t.step,i=n*r,o=this.time,u=o[e],a=u+i;this.setValue(o),this.updateValue(e,a)},updateValue:function(t,e,n){this.setValue(this.updateTime(t,e,n))},updateTime:function(t,e,n){n=n||{},n.overflowHourToMeridian=this.props.overflowHourToMeridian;var r=this.time;return r=s(r,t,e,n),this.time=r},setValue:function(t){null==this.props.value&&this.setState({defaultValue:t}),(this.props.onChange||r)(this.props.timeToString(t),o({},t))},format:function(t,e,n){var r;return arguments.length<3&&(n=t.time[e]),r="meridian"!=e?t["format"+c(e)]:t.formatMeridian,r||"string"!=typeof t.format||(r=function(e,n){return v(n,e,t.formatInfo)}),"function"==typeof r&&(n=r(n,e,t)),n},renderBox:function(t,e){var n,r=this.state,u=t[e+"Style"],a=t[e+"InputStyle"],s=c(e);n=r.focused[e]?r.focused[e].value:this.format(t,e);var l,p;if(t.showArrows){var d={style:t.arrowUpStyle,children:"▴"};d[f.onMouseDown]=this.onArrowMouseDown.bind(this,t,1,e);var h={style:t.arrowDownStyle,children:"▾"};h[f.onMouseDown]=this.onArrowMouseDown.bind(this,t,-1,e);var m=t.defaultArrowFactory,v=t.arrowUpFactory||t.arrowFactory||m,y=t.arrowDownFactory||t.arrowFactory||m;l=v(d),void 0===l&&(l=m(d)),p=y(h),void 0===p&&(p=m(h))}var S=t.defaultInputFactory,w=t[e+"InputFactory"]||t.inputFactory||S,x=t["default"+s+"InputProps"],M=o({},x,{style:a,value:n,onFocus:this.handleInputFocus.bind(this,t,e),onBlur:this.handleInputBlur.bind(this,t,e),onChange:this.handleInputChange.bind(this,t,e)});"meridian"==e&&(M.onMouseDown=this.onMeridianInputMouseDown.bind(this,t));var g=w(M);return void 0===g&&(g=S(M)),i.createElement("div",{style:u},l,g,p)},handleInputFocus:function(t,e){var n=this.state.focused;n[e]={value:this.format(t,e)},this.setState({})},handleInputBlur:function(t,e,n){this.state.focused[e]=null,this.setState({});var r=1*n.target.value;this.updateValue(e,r,{clamp:t.clamp})},handleInputChange:function(t,e,n){this.state.focused[e]&&(this.state.focused[e].value=n.target.value),this.setState({}),t.stopChangePropagation&&n.stopPropagation()},getTime:function(){return a(this.getValue(),{strict:this.props.strict})},prepareTime:function(t){var e=this.getTime();return t.showSecond=t.formatInfo?t.formatInfo.second.specified:void 0!==e.second,t.showMinute=t.formatInfo?t.formatInfo.minute.specified:void 0!==e.minute,t.withMeridian=t.formatInfo?t.formatInfo.meridian.specified:null!=e.meridian,e},getValue:function(){var t=null==this.props.value?this.state.defaultValue:this.props.value;return t},renderHour:function(t){return this.renderBox(t,"hour")},renderMinute:function(t){return t.showMinute?this.renderBox(t,"minute"):void 0},renderSecond:function(t){return t.showSecond?this.renderBox(t,"second"):void 0},renderMeridian:function(t){return t.withMeridian?this.renderBox(t,"meridian"):void 0},prepareProps:function(t,e){var n=o({},t);return n.formatInfo=m(n.format),this.time=n.time=this.prepareTime(n,e),this.prepareStyles(n,e),n},prepareStyles:function(t,e){t.style=this.prepareStyle(t,e),t.separatorStyle=this.prepareSeparatorStyle(t,e),this.prepareArrowStyles(t,e),this.prepareHourStyles(t,e),this.prepareMinuteStyles(t,e),this.prepareSecondStyles(t,e),this.prepareMeridianStyles(t,e)},prepareStyle:function(t){return u(o({},t.defaultStyle,t.style))},prepareSeparatorStyle:function(t){return u(o({},t.defaultSeparatorStyle,t.separatorStyle))},prepareArrowStyles:function(t){t.arrowUpStyle=u(o({},t.defaultArrowStyle,t.defaultArrowUpStyle,t.arrowUpStyle)),t.arrowDownStyle=u(o({},t.defaultArrowStyle,t.defaultArrowDownStyle,t.arrowDownStyle))},prepareHourStyles:function(t,e){t.hourStyle=this.prepareHourStyle(t,e),t.hourInputStyle=this.prepareHourInputStyle(t,e)},prepareHourStyle:function(t){return u(o({},t.defaultBoxStyle,t.defaultHourStyle,t.hourStyle))},prepareHourInputStyle:function(t){return u(o({},t.defaultInputStyle,t.defaultHourInputStyle,t.hourInputStyle))},prepareMinuteStyles:function(t,e){t.minuteStyle=this.prepareMinuteStyle(t,e),t.minuteInputStyle=this.prepareMinuteInputStyle(t,e)},prepareMinuteStyle:function(t){return u(o({},t.defaultBoxStyle,t.defaultMinuteStyle,t.minuteStyle))},prepareMinuteInputStyle:function(t){return u(o({},t.defaultInputStyle,t.defaultMinuteInputStyle,t.minuteInputStyle))},prepareSecondStyles:function(t,e){t.showSecond&&(t.secondStyle=this.prepareSecondStyle(t,e),t.secondInputStyle=this.prepareSecondInputStyle(t,e))},prepareSecondStyle:function(t){return u(o({},t.defaultBoxStyle,t.defaultSecondStyle,t.secondStyle))},prepareSecondInputStyle:function(t){return u(o({},t.defaultInputStyle,t.defaultSecondInputStyle,t.secondInputStyle))},prepareMeridianStyles:function(t,e){t.withMeridian&&(t.meridianStyle=this.prepareMeridianStyle(t,e),t.meridianInputStyle=this.prepareMeridianInputStyle(t,e))},prepareMeridianStyle:function(t){return u(o({},t.defaultBoxStyle,t.defaultMeridianStyle,t.meridianStyle))},prepareMeridianInputStyle:function(t){return u(o({},t.defaultInputStyle,t.defaultMeridianInputStyle,t.meridianInputStyle))}})},function(t){"use strict";function e(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t){for(var n,r,i=e(t),o=1;o<arguments.length;o++){n=arguments[o],r=Object.keys(Object(n));for(var u=0;u<r.length;u++)i[r[u]]=n[r[u]]}return i}},function(t,e,n){"use strict";var r=n(12),i=n(3),o=n(14),u=n(13),a={hour:r,minute:i,second:o,meridian:u};t.exports=function(t,e,n){var r=a[t];return!(!r||!r(e,n))}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e){return r(t,e)?(t*=1,t>=0&&60>t):!1}},function(t,e,n){"use strict";var r=n(1),i=n(9);t.exports=function(t,e){var n=!isNaN(1*t);return e=e?r({},i,e):i,n&&"string"==typeof t&&e.twoDigits&&(n=2==t.length),n&&(t=1*t,n=parseInt(t)===t),n}},function(t,e){(function(e){"use strict";var n;e.document&&(n=e.document.createElement("div")),t.exports=n}).call(e,function(){return this}())},function(t,e,n){"use strict";var r,i=n(7),o=["ms","Moz","Webkit","O"],u=n(5);t.exports=function(t){if(r)return r;for(var e,n,a=0,s=o.length;s>a;a++)if(n=o[a],e=n+i(t),"undefined"!=typeof u.style[e])return r=n}},function(t){"use strict";t.exports=function(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}},function(t){"use strict";function e(t,e,n,r){if(void 0!==t.hour){var i=!r||r.overflowHourToMeridian!==!1,o=t.meridian||r&&r.meridian,u=o?12:23,a=o?12:24,s=0;n>u&&(s+=Math.floor(n/u),n%=a),0>n&&(s=Math.ceil(-n/u),n=a+n),o&&n===u&&(t.minute>0||t.second>0)&&(s+=1,n=0),o&&s%2==1&&i&&("string"==typeof o&&(o=o.toUpperCase()),t.meridian="PM"==o?"AM":"PM"),t.hour=n}}function n(t,e,n,r,i){if(void 0!==t[e]){var o=0;n>59&&(o+=Math.floor(n/60),n%=60),0>n&&(o-=Math.ceil(-n/60),n=60+n),t[e||"minute"]=n,o&&(t[i||"hour"]+=o)}}function r(t,r,i,o){n(t,"minute",t.minute,o),e(t,"hour",t.hour,o)}function i(t,e,i,o){n(t,"second",t.second,o,"minute"),r(t,"minute",t.minute,o)}var o={},u={hour:e,minute:r,second:i};t.exports=function(t,e,n,r){return 2==arguments.length&&(r=e,e="second",n=t[e]),u[e](t,e,n,r||o),t}},function(t){"use strict";t.exports={separator:":",twoDigits:!0}},function(t,e,n){"use strict";function r(t){return t.trim()}function i(t,e){return h(t,e)?1*t:void 0}function o(t){return m(t)?1*t:void 0}function u(t){return v(t)?1*t:void 0}function a(t){return y(t)?t:void 0}function s(t){var e=t.split(" ");return e.length>1}function c(t){return S[t]}function l(t,e,n){var i,o,u=n&&n.meridian,s=t.split(" ").map(r),l=c(e),p={invalid:[]};return w(e,s[0],n)?l&&(i=l(s[0],n)):p.invalid.push({name:e,value:s[0]}),u&&(o=a(s[1]),void 0===o&&p.invalid.push({name:"meridian",value:s[1]})),void 0!==o&&(p.meridian=o),void 0!==i&&(p[e]=i),p}function p(t,e){e=f({},d,e);var n=t.split(e.separator).map(r),u=s(n[n.length-1]);e.meridian=u;var a,c,p=[],h={};return n.length>3?void 0:(1==n.length&&f(h,l(n[0],"hour",e)),2==n.length&&(a=i(n[0],e),void 0===a&&p.push({name:"hour",value:n[0]}),f(h,l(n[1],"minute",e))),3==n.length&&(a=i(n[0],e),c=o(n[1]),void 0===a&&p.push({name:"hour",value:n[0]}),void 0===c&&p.push({name:"minute",value:n[1]}),f(h,l(n[2],"second",e))),h.invalid&&(p.push.apply(p,h.invalid),h.invalid=p),void 0!==a&&(h.hour=a),void 0!==c&&(h.minute=c),h.invalid.length||delete h.invalid,h)}var f=n(1),d=n(9),h=n(12),m=n(3),v=n(14),y=n(13),S={hour:i,minute:o,second:u,meridian:a},w=n(2),x=n(11),M=n(20),g=n(8);p.isValidPart=w,p.isValidTime=x,p.updateTime=M,p.adjustOverflow=g,t.exports=p},function(t,e,n){"use strict";var r=n(2),i=n(1);t.exports=function(t,e){var n=void 0===t.second||r("second",t.second,e),o=n&&(void 0===t.minute||r("minute",t.minute,e)),u=o&&r("hour",t.hour,i({meridian:t.meridian},e)),a=t.meridian,s=u&&(a?r("meridian",a,e):!0),c=s;if(c&&a){var l=1*t.hour;12===l&&(c=1*t.minute===0&&1*t.second===0)}return c}},function(t,e,n){"use strict";var r=n(4);t.exports=function(t,e){var n=e&&e.meridian;return r(t,e)?(t*=1,n?t>=0&&12>=t:t>=0&&24>t):!1}},function(t){"use strict";t.exports=function(t){return t?(t=t.toUpperCase(),"AM"==t||"PM"==t):!1}},function(t,e,n){"use strict";var r=n(3);t.exports=function(t,e){return r(t,e)}},function(t,e){(function(e){t.exports="ontouchstart"in e||e.DocumentTouch&&document instanceof DocumentTouch}).call(e,function(){return this}())},function(t){"use strict";t.exports={alignItems:1,justifyContent:1,flex:1,flexFlow:1,userSelect:1,transform:1,transition:1,transformOrigin:1,transformStyle:1,transitionProperty:1,transitionDuration:1,transitionTimingFunction:1,transitionDelay:1,borderImage:1,borderImageSlice:1,boxShadow:1,backgroundClip:1,backfaceVisibility:1,perspective:1,perspectiveOrigin:1,animation:1,animationDuration:1,animationName:1,animationDelay:1,animationDirection:1,animationIterationCount:1,animationTimingFunction:1,animationPlayState:1,animationFillMode:1,appearance:1}},function(t){"use strict";function e(t){var e=1,n=!1,r=t.indexOf("h");return~r?(n=!0,"h"==t.charAt(r+1)&&e++):(r=t.indexOf("H"),~r&&(n=!0,"H"==t.charAt(r+1)&&e++)),{len:e,specified:n}}function n(t){var e=1,n=!1,r=t.indexOf("m");return~r&&(n=!0,"m"==t.charAt(r+1)&&e++),{len:e,specified:n}}function r(t){var e=1,n=!1,r=t.indexOf("s");return~r&&(n=!0,"s"==t.charAt(r+1)&&e++),{len:e,specified:n}}function i(t){var e=!0,n=!1,r=t.indexOf("a");return~r?(n=!0,e=!1):~t.indexOf("A")&&(n=!0),{uppercase:e,lowercase:!e,specified:n}}t.exports=function(t){return"string"==typeof t?{hour:e(t),minute:n(t),second:r(t),meridian:i(t)}:void 0}},function(t){"use strict";t.exports=function(t){return 10>t?"0"+t:t}},function(t){"use strict";t.exports=function(t,e,n){if("meridian"==e)return n;if("hour"==e){var r=24;return t.meridian&&(r=t.hour||t.minute?11:12),0>n?0:n>r?r:n}return 0>n?0:n>59?59:n}},function(t,e,n){"use strict";var r=n(1),i=n(4),o=n(2),u=n(11),a=n(8),s=n(19);t.exports=function(t,e,n,c){var l=t,p=i(n,c),f=o(e,n,c);if(t=r({},t),c=c||{},p&&(n*=1),(f||p)&&(t[e]=n),!u(t,c)&&c.clamp&&(t[e]=s(t,e,t[e])),!u(t,c)){if(c.rejectInvalid)return l;c.overflow!==!1&&(t=a(t,c))}return t}},1,function(t,e,n){"use strict";t.exports=n(15)?{onMouseDown:"onTouchStart",onMouseUp:"onTouchEnd",onMouseMove:"onTouchMove"}:{onMouseDown:"onMouseDown",onMouseUp:"onMouseUp",onMouseMove:"onMouseMove"}},function(t,e,n){"use strict";var r=n(7),i=n(6),o=n(16);t.exports=function(t){if(!o[t])return t;var e=i(t);return e?e+r(t):t}},function(t,e,n){"use strict";var r=n(6),i=n(23),o=n(5),u={},a=o.style;t.exports=function(t,e){var n=t+": "+e;if(u[n])return u[n];var s,c,l;return t in a||(s=r("appearance"),s&&(c=i(t,e),l="-"+s.toLowerCase()+"-"+e,c in a&&(o.style[c]="",o.style[c]=l,""!==o.style[c]&&(e=l)))),u[n]=e,e}},function(t,e,n){"use strict";var r=n(26),i=n(16);t.exports=function(t,e){return i[t]?r(t,e):t}},function(t,e,n){"use strict";var r=n(7),i=n(6),o=n(5),u={},a=o.style;t.exports=function(t){var e=t;if(u[e])return u[e];var n,o;return t in a||(n=i("appearance"),n&&(o=n+r(t),o in a&&(t=o))),u[e]=t,t}},function(t){"use strict";t.exports=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";function r(t,e){var n={key:t,value:e};return(c.plugins||[]).forEach(function(r){var i=a(function(n){return r(t,e,n)},n);i&&(n=i)}),n}function i(t,e){var n=r(t,e);return a(function(t){return{key:u(t.key,t.value),value:t.value}},n)}var o=n(27),u=n(25),a=n(29),s=n(30),c=function(t){var e,n,r={};for(e in t)if(o(t,e)){if(n=i(e,t[e]),!n)continue;a(function(t){r[t.key]=t.value},n)}return r};t.exports=s(c)},function(t){"use strict";t.exports=function(t,e){return e?Array.isArray(e)?e.map(t).filter(function(t){return!!t}):t(e):void 0}},function(t,e,n){"use strict";var r=n(24);t.exports=function(t){return t.plugins=t.plugins||[function(){var t={flex:1,"inline-flex":1};return function(e,n){return"display"===e&&n in t?{key:e,value:r(e,n)}:void 0}}()],t.plugin=function(e){t.plugins=t.plugins||[],t.plugins.push(e)},t}},function(t,e,n){"use strict";var r=n(18),i=n(17);t.exports=function(t,e,n){var o=n;if(o&&o.hour&&"string"!=typeof o||(o=i(o)),!o)return"";var u=o[t];return"meridian"===t&&u.specified?u.uppercase?e.toUpperCase():e.toLowerCase():u.specified?2==u.len?r(e):e:""}},function(t,e,n){"use strict";function r(t,e){return t.invalid.forEach(function(e){var n=e.name,r=1*e.value;isNaN(r)||(t[n]=r)}),o(t,e)}var i=n(10),o=i.adjustOverflow,u={};t.exports=function(t,e){e=e||u,t=t||"","string"==typeof t&&(t=i(t));var n={};t&&(e.withMeridian=null!=t.meridian,t.invalid&&t.invalid.forEach(function(t){n[t.name]=!0}),!e.strict&&t.invalid&&(t=r(t,e)),n.hour&&(t.hour=t.hour||0),n.minute&&(t.minute=t.minute||0),n.second&&(t.second=t.second||0),e.strict&&t.meridian&&12===t.hour&&(void 0!==t.minute&&(t.minute=0),void 0!==t.second&&(t.second=0)));var o={hour:t.hour};return void 0!==t.minute&&(o.minute=t.minute),void 0!==t.second&&(o.second=t.second),e.withMeridian&&(o.meridian=t.meridian),o}},function(t){"use strict";function e(t){return 10>t?"0"+t:t}t.exports=function(t){var n=e(t.hour);return null!=t.minute&&(n+=":"+e(t.minute)),null!=t.second&&(n+=":"+e(t.second)),t.meridian&&(n+=" "+t.meridian),n}},7,function(t,e,n){"use strict";var r=n(10).updateTime;t.exports=function(t,e,n,i){return t=r(t,e,n,i)}},function(e){e.exports=t}]))}); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var VALUE = '11:00:56' | ||
var VALUE = '11:00 PM' | ||
var App = React.createClass({ | ||
@@ -12,2 +12,6 @@ | ||
function meridian(v){ | ||
return v | ||
} | ||
var add = function(allTags){ | ||
@@ -19,2 +23,3 @@ tags = allTags | ||
var onChange = function(value, time){ | ||
// console.log(value) | ||
VALUE = value | ||
@@ -28,4 +33,2 @@ this.setState({}) | ||
overflowHourToMeridian={true} | ||
strict={true} | ||
clamp={false} | ||
onChange={onChange} | ||
@@ -32,0 +35,0 @@ style={{margin: 20, width: 200}}/> |
@@ -17,10 +17,8 @@ 'use strict'; | ||
function twoDigits(value){ | ||
return value < 10? | ||
'0' + value: | ||
value | ||
} | ||
function emptyFn(){} | ||
var twoDigits = require('./twoDigits') | ||
var getFormatInfo = require('./getFormatInfo') | ||
var format = require('./format') | ||
module.exports = React.createClass({ | ||
@@ -57,4 +55,4 @@ | ||
hourStep: null, | ||
minuteStep: 10, | ||
secondStep: 30, | ||
minuteStep: 1, | ||
secondStep: 20, | ||
@@ -64,4 +62,2 @@ stepDelay:60, | ||
// showMinute: true, | ||
// showSecond: true, | ||
defaultStyle: { | ||
@@ -133,3 +129,3 @@ border: '1px solid gray', | ||
var separator = props.separator || React.createElement("span", {style: props.separatorStyle}, WHITESPACE + ':' + WHITESPACE) | ||
var hourSeparator = props.hourSeparator || separator | ||
var hourSeparator = hour && (minute || second || meridian)? props.hourSeparator || separator: null | ||
var minuteSeparator = minute && (second || meridian)? props.minuteSeparator || separator: null | ||
@@ -187,3 +183,11 @@ var secondSeparator = (second && meridian)? props.secondSeparator || separator: null | ||
onArrowMeridianAction: function(props, dir, name){ | ||
this.updateValue(name, this.time.meridian == 'AM'? 'PM': 'AM') | ||
var currentMeridian = this.time.meridian | ||
var lowercase = currentMeridian == 'am' || currentMeridian == 'pm' | ||
var newValue = lowercase? | ||
currentMeridian == 'am'? 'pm': 'am' | ||
: | ||
currentMeridian == 'AM'? 'PM': 'AM' | ||
this.updateValue(name, newValue) | ||
}, | ||
@@ -256,3 +260,3 @@ | ||
if (name != 'meridian'){ | ||
formatFn = props['format' + toUpperFirst(name)] || props.format | ||
formatFn = props['format' + toUpperFirst(name)] | ||
} else { | ||
@@ -262,4 +266,10 @@ formatFn = props.formatMeridian | ||
if (!formatFn && typeof props.format == 'string'){ | ||
formatFn = function(value, name){ | ||
return format(name, value, props.formatInfo) | ||
} | ||
} | ||
if (typeof formatFn == 'function'){ | ||
value = formatFn(value) | ||
value = formatFn(value, name, props) | ||
} | ||
@@ -387,6 +397,14 @@ | ||
props.showSecond = timeValue.second !== undefined | ||
props.showMinute = timeValue.minute !== undefined | ||
props.withMeridian = timeValue.meridian != null | ||
props.showSecond = props.formatInfo? | ||
props.formatInfo.second.specified: | ||
timeValue.second !== undefined | ||
props.showMinute = props.formatInfo? | ||
props.formatInfo.minute.specified: | ||
timeValue.minute !== undefined | ||
props.withMeridian = props.formatInfo? | ||
props.formatInfo.meridian.specified: | ||
timeValue.meridian != null | ||
return timeValue | ||
@@ -428,2 +446,3 @@ }, | ||
props.formatInfo = getFormatInfo(props.format) | ||
this.time = props.time = this.prepareTime(props, state) | ||
@@ -430,0 +449,0 @@ this.prepareStyles(props, state) |
{ | ||
"name": "react-time-picker", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "React Time Picker", | ||
@@ -26,4 +26,2 @@ "main": "lib/index.js", | ||
"should": "^5.0.0", | ||
"style-loader": "^0.8.2", | ||
"stylus-loader": "^0.4.0", | ||
"webpack": "^1.4.13", | ||
@@ -36,11 +34,11 @@ "webpack-dev-server": "^1.6.6" | ||
"parse-time": "^0.1.1", | ||
"react": "^0.12.2", | ||
"react-event-names": "^1.0.0", | ||
"react-field-component-utils": "radubrehar/react-field-component-utils", | ||
"react-input-field": "^1.1.6", | ||
"react-style-normalizer": "^1.1.3" | ||
"react-style-normalizer": "^1.2.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=0.12.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/radubrehar/react-time-picker.git" | ||
"url": "https://github.com/zippyui/react-time-picker.git" | ||
}, | ||
@@ -54,8 +52,11 @@ "keywords": [ | ||
], | ||
"author": "Radu Brehar", | ||
"author": "Zippy Technologies", | ||
"contributors": [ | ||
"Radu Brehar <radu@evanghelic.ro>" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/radubrehar/react-time-picker/issues" | ||
"url": "https://github.com/zippyui/react-time-picker/issues" | ||
}, | ||
"homepage": "https://github.com/radubrehar/react-time-picker" | ||
"homepage": "https://github.com/zippyui/react-time-picker" | ||
} |
@@ -10,3 +10,2 @@ 'use strict'; | ||
var toUpperFirst = require('./toUpperFirst') | ||
var timeToString = require('./timeToString') | ||
@@ -18,10 +17,9 @@ var hasTouch = require('has-touch') | ||
function twoDigits(value){ | ||
return value < 10? | ||
'0' + value: | ||
value | ||
} | ||
function emptyFn(){} | ||
var twoDigits = require('./twoDigits') | ||
var getFormatInfo = require('./getFormatInfo') | ||
var format = require('./format') | ||
var formatTime = require('./formatTime') | ||
module.exports = React.createClass({ | ||
@@ -51,3 +49,2 @@ | ||
//makes 15:78 be converted to 15:00, and not to 16:18 | ||
@@ -59,4 +56,4 @@ strict: true, | ||
hourStep: null, | ||
minuteStep: 10, | ||
secondStep: 30, | ||
minuteStep: 1, | ||
secondStep: 1, | ||
@@ -66,4 +63,2 @@ stepDelay:60, | ||
// showMinute: true, | ||
// showSecond: true, | ||
defaultStyle: { | ||
@@ -102,7 +97,7 @@ border: '1px solid gray', | ||
}, | ||
format: twoDigits, | ||
formatHour: null, | ||
formatMinute: null, | ||
formatSecond: null, | ||
formatMeridian: null, | ||
// format: 'HH:mm:ss', | ||
renderHour: null, | ||
renderMinute: null, | ||
renderSecond: null, | ||
renderMeridian: null, | ||
@@ -123,3 +118,3 @@ defaultArrowFactory: React.DOM.span, | ||
timeToString: timeToString | ||
timeToString: formatTime | ||
} | ||
@@ -137,3 +132,3 @@ }, | ||
var separator = props.separator || <span style={props.separatorStyle}>{WHITESPACE + ':' + WHITESPACE}</span> | ||
var hourSeparator = props.hourSeparator || separator | ||
var hourSeparator = hour && (minute || second || meridian)? props.hourSeparator || separator: null | ||
var minuteSeparator = minute && (second || meridian)? props.minuteSeparator || separator: null | ||
@@ -191,3 +186,11 @@ var secondSeparator = (second && meridian)? props.secondSeparator || separator: null | ||
onArrowMeridianAction: function(props, dir, name){ | ||
this.updateValue(name, this.time.meridian == 'AM'? 'PM': 'AM') | ||
var currentMeridian = this.time.meridian | ||
var lowercase = currentMeridian == 'am' || currentMeridian == 'pm' | ||
var newValue = lowercase? | ||
currentMeridian == 'am'? 'pm': 'am' | ||
: | ||
currentMeridian == 'AM'? 'PM': 'AM' | ||
this.updateValue(name, newValue) | ||
}, | ||
@@ -222,3 +225,3 @@ | ||
this.setValue(time) | ||
// this.setValue(time) | ||
this.updateValue(name, newValue) | ||
@@ -250,7 +253,7 @@ }, | ||
;(this.props.onChange || emptyFn)(this.props.timeToString(time), assign({}, time)) | ||
;(this.props.onChange || emptyFn)(this.props.timeToString(time, this.props.format), assign({}, time)) | ||
}, | ||
format: function(props, name, value){ | ||
var formatFn | ||
var renderFn | ||
@@ -262,11 +265,22 @@ if (arguments.length < 3){ | ||
if (name != 'meridian'){ | ||
formatFn = props['format' + toUpperFirst(name)] || props.format | ||
renderFn = props['render' + toUpperFirst(name)] | ||
} else { | ||
formatFn = props.formatMeridian | ||
renderFn = props.renderMeridian | ||
} | ||
if (typeof formatFn == 'function'){ | ||
value = formatFn(value) | ||
if (!renderFn && typeof props.format == 'string'){ | ||
var formatInfo = this.formatInfo | ||
renderFn = function(value, name){ | ||
return format(name, value, formatInfo) | ||
} | ||
} | ||
if (!renderFn){ | ||
renderFn = twoDigits | ||
} | ||
if (typeof renderFn == 'function'){ | ||
value = renderFn(value, name, props) | ||
} | ||
return value | ||
@@ -384,4 +398,13 @@ }, | ||
getTime: function(){ | ||
var strict = this.props.strict | ||
var formatInfo = this.formatInfo = getFormatInfo(this.props.format) | ||
return parseTime(this.getValue(), { | ||
strict: this.props.strict | ||
strict: strict, | ||
hour : formatInfo.hour, | ||
minute : formatInfo.minute, | ||
second : formatInfo.second, | ||
meridian: formatInfo.meridian | ||
}) | ||
@@ -391,8 +414,19 @@ }, | ||
prepareTime: function(props, state) { | ||
var timeValue = this.getTime() | ||
var timeValue = this.getTime() | ||
var formatInfo = this.props.format? | ||
this.formatInfo: | ||
null | ||
props.showSecond = timeValue.second !== undefined | ||
props.showMinute = timeValue.minute !== undefined | ||
props.withMeridian = timeValue.meridian != null | ||
props.showSecond = formatInfo? | ||
formatInfo.second.specified: | ||
timeValue.second !== undefined | ||
props.showMinute = formatInfo? | ||
formatInfo.minute.specified: | ||
timeValue.minute !== undefined | ||
props.withMeridian = formatInfo? | ||
formatInfo.meridian.specified: | ||
timeValue.meridian != null | ||
return timeValue | ||
@@ -399,0 +433,0 @@ }, |
@@ -30,3 +30,3 @@ 'use strict'; | ||
if (typeof value == 'string'){ | ||
value = parseTime(value) | ||
value = parseTime(value, config) | ||
} | ||
@@ -33,0 +33,0 @@ |
@@ -10,3 +10,4 @@ module.exports = { | ||
externals: { | ||
'react': 'React' | ||
'react': 'React', | ||
'moment': 'moment' | ||
}, | ||
@@ -13,0 +14,0 @@ resolve: { |
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
104339
6
10
31
2951
0
0
+ Addedreact@19.0.0(transitive)
- Removedreact@^0.12.2
- Removedreact-field-component-utils@radubrehar/react-field-component-utils
- Removedreact-input-field@^1.1.6
- Removedacorn@5.7.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedast-types@0.9.6(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase62@1.2.8(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcommoner@0.10.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddefined@1.0.1(transitive)
- Removeddetective@4.7.1(transitive)
- Removedenvify@3.4.1(transitive)
- Removedesprima@3.1.3(transitive)
- Removedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
- Removedglob@5.0.15(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjstransform@11.0.3(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednormalize.css@3.0.3(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedq@1.5.1(transitive)
- Removedreact@0.12.2(transitive)
- Removedreact-input-field@1.2.4(transitive)
- Removedrecast@0.11.23(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsource-map@0.4.40.5.7(transitive)
- Removedthrough@2.3.8(transitive)
- Removedwrappy@1.0.2(transitive)