@seafile/seafile-calendar 0.1.3-beta.1 → 0.1.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,8 +3,6 @@ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructo
|
|
|
3
3
|
import _inherits from 'babel-runtime/helpers/inherits';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import dayjs from 'dayjs';
|
|
7
|
-
import { tokenizeFormattedDate } from '../util';
|
|
8
6
|
|
|
9
7
|
var CalendarRightPanel = function (_React$Component) {
|
|
10
8
|
_inherits(CalendarRightPanel, _React$Component);
|
|
@@ -69,7 +67,6 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
69
67
|
prefixCls = _props.prefixCls,
|
|
70
68
|
locale = _props.locale;
|
|
71
69
|
|
|
72
|
-
var selectedDate = value.format().slice(0, String(value.format()).indexOf('T'));
|
|
73
70
|
var highlight = this.state.highlightTime;
|
|
74
71
|
var highlightTime = highlight ? highlight.format().slice(11, 16) : null;
|
|
75
72
|
var isZhcn = locale && locale.today === '今天';
|
|
@@ -88,8 +85,11 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
88
85
|
'ul',
|
|
89
86
|
null,
|
|
90
87
|
this.times.map(function (time) {
|
|
91
|
-
var
|
|
92
|
-
|
|
88
|
+
var _time$split = time.split(':'),
|
|
89
|
+
hour = _time$split[0],
|
|
90
|
+
minute = _time$split[1];
|
|
91
|
+
|
|
92
|
+
var current = value.clone().hour(parseInt(hour, 10)).minute(parseInt(minute, 10)).second(0);
|
|
93
93
|
current = isZhcn ? current.locale('zh-cn') : current.locale('en-gb');
|
|
94
94
|
return React.createElement(
|
|
95
95
|
'li',
|
package/es/util/index.js
CHANGED
|
@@ -192,11 +192,12 @@ export function hasSpecialChar(str) {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
export function validateTime(inputTime) {
|
|
195
|
+
console.log('validateTime inputTime1:', inputTime);
|
|
195
196
|
if (!inputTime || typeof inputTime !== 'string') {
|
|
196
197
|
return getCurrentTime();
|
|
197
198
|
}
|
|
198
199
|
var trimmed = inputTime.trim();
|
|
199
|
-
var timeRegex = /^(\d{2}):(\d{2})$/;
|
|
200
|
+
var timeRegex = /^(\d{1,2}):(\d{1,2})$/;
|
|
200
201
|
var match = trimmed.match(timeRegex);
|
|
201
202
|
if (!match) {
|
|
202
203
|
return getCurrentTime();
|
|
@@ -206,7 +207,9 @@ export function validateTime(inputTime) {
|
|
|
206
207
|
if (hour > 23 || minute > 59) {
|
|
207
208
|
return getCurrentTime();
|
|
208
209
|
}
|
|
209
|
-
|
|
210
|
+
var h = String(hour).padStart(2, '0');
|
|
211
|
+
var m = String(minute).padStart(2, '0');
|
|
212
|
+
return h + ':' + m;
|
|
210
213
|
}
|
|
211
214
|
|
|
212
215
|
export function delimate(format) {
|
|
@@ -22,12 +22,6 @@ var _propTypes = require('prop-types');
|
|
|
22
22
|
|
|
23
23
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
24
24
|
|
|
25
|
-
var _dayjs = require('dayjs');
|
|
26
|
-
|
|
27
|
-
var _dayjs2 = _interopRequireDefault(_dayjs);
|
|
28
|
-
|
|
29
|
-
var _util = require('../util');
|
|
30
|
-
|
|
31
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
32
26
|
|
|
33
27
|
var CalendarRightPanel = function (_React$Component) {
|
|
@@ -93,7 +87,6 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
93
87
|
prefixCls = _props.prefixCls,
|
|
94
88
|
locale = _props.locale;
|
|
95
89
|
|
|
96
|
-
var selectedDate = value.format().slice(0, String(value.format()).indexOf('T'));
|
|
97
90
|
var highlight = this.state.highlightTime;
|
|
98
91
|
var highlightTime = highlight ? highlight.format().slice(11, 16) : null;
|
|
99
92
|
var isZhcn = locale && locale.today === '今天';
|
|
@@ -112,8 +105,11 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
112
105
|
'ul',
|
|
113
106
|
null,
|
|
114
107
|
this.times.map(function (time) {
|
|
115
|
-
var
|
|
116
|
-
|
|
108
|
+
var _time$split = time.split(':'),
|
|
109
|
+
hour = _time$split[0],
|
|
110
|
+
minute = _time$split[1];
|
|
111
|
+
|
|
112
|
+
var current = value.clone().hour(parseInt(hour, 10)).minute(parseInt(minute, 10)).second(0);
|
|
117
113
|
current = isZhcn ? current.locale('zh-cn') : current.locale('en-gb');
|
|
118
114
|
return _react2['default'].createElement(
|
|
119
115
|
'li',
|
package/lib/util/index.js
CHANGED
|
@@ -227,11 +227,12 @@ function hasSpecialChar(str) {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
function validateTime(inputTime) {
|
|
230
|
+
console.log('validateTime inputTime1:', inputTime);
|
|
230
231
|
if (!inputTime || typeof inputTime !== 'string') {
|
|
231
232
|
return getCurrentTime();
|
|
232
233
|
}
|
|
233
234
|
var trimmed = inputTime.trim();
|
|
234
|
-
var timeRegex = /^(\d{2}):(\d{2})$/;
|
|
235
|
+
var timeRegex = /^(\d{1,2}):(\d{1,2})$/;
|
|
235
236
|
var match = trimmed.match(timeRegex);
|
|
236
237
|
if (!match) {
|
|
237
238
|
return getCurrentTime();
|
|
@@ -241,7 +242,9 @@ function validateTime(inputTime) {
|
|
|
241
242
|
if (hour > 23 || minute > 59) {
|
|
242
243
|
return getCurrentTime();
|
|
243
244
|
}
|
|
244
|
-
|
|
245
|
+
var h = String(hour).padStart(2, '0');
|
|
246
|
+
var m = String(minute).padStart(2, '0');
|
|
247
|
+
return h + ':' + m;
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
function delimate(format) {
|