Safari does not understand new Date(YYYY-MM-DD HH:MM:SS)
parent
95af62423c
commit
843ed7c889
|
@ -73,22 +73,22 @@ export class Calendar extends preact.Component
|
|||
{
|
||||
var i = this.props.input;
|
||||
var t = i.value.split(/\s+/, 2)[1]||'';
|
||||
if (t)
|
||||
t = ' '+t;
|
||||
month = Number(month)+1;
|
||||
if (month < 10)
|
||||
month = '0'+month;
|
||||
if (day < 10)
|
||||
day = '0'+day;
|
||||
if (this.props.callback)
|
||||
{
|
||||
// Safari does not understand new Date('YYYY-MM-DD HH:MM:SS')
|
||||
t = t ? t.split(/:/) : null;
|
||||
t = t ? new Date(year-0, month-1, day-0, t[0]-0, t[1]-0, t[2]-0) : new Date(year-0, month-1, day-0);
|
||||
var c = this.props.callback;
|
||||
t = year + '-' + month + '-' + day + t;
|
||||
c(new Date(t));
|
||||
}
|
||||
else
|
||||
{
|
||||
t = (this.format == 'Y-m-d' ? year + '-' + month + '-' + day : day + '.' + month + '.' + year) + t;
|
||||
if (month < 10)
|
||||
month = '0'+month;
|
||||
if (day < 10)
|
||||
day = '0'+day;
|
||||
t = (this.format == 'Y-m-d' ? year + '-' + month + '-' + day : day + '.' + month + '.' + year) + (t ? ' '+t : '');
|
||||
i.value = t;
|
||||
if ("Event" in window)
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
calendar.js
12
calendar.js
|
@ -81,18 +81,18 @@ export class Calendar
|
|||
selectDate(year, month, day)
|
||||
{
|
||||
var i = this.input;
|
||||
var t = i.value.split(/\s+/, 2)[1]||'';
|
||||
if (t)
|
||||
t = ' '+t;
|
||||
var t = i.value.split(/[\s]+/, 2)[1]||'';
|
||||
if (this.callback)
|
||||
{
|
||||
// Safari does not understand new Date('YYYY-MM-DD HH:MM:SS')
|
||||
t = t ? t.split(/:/) : null;
|
||||
t = t ? new Date(year-0, month-1, day-0, t[0]-0, t[1]-0, t[2]-0) : new Date(year-0, month-1, day-0);
|
||||
var c = this.callback;
|
||||
t = year + '-' + month + '-' + day + t;
|
||||
c(new Date(t));
|
||||
c(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = (this.format == 'Y-m-d' ? year + '-' + month + '-' + day : day + '.' + month + '.' + year) + t;
|
||||
t = (this.format == 'Y-m-d' ? year + '-' + month + '-' + day : day + '.' + month + '.' + year) + (t ? ' '+t : '');
|
||||
i.value = t;
|
||||
if ("Event" in window)
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,14 +9,14 @@
|
|||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-stage-1": "^6.24.1",
|
||||
"preact": "^8.2.9",
|
||||
"uglify-js": "^3.3.15",
|
||||
"webpack": "^4.14.0",
|
||||
"uglify-js": "^3.4.9",
|
||||
"webpack": "^4.26.1",
|
||||
"webpack-cli": "^3.0.8"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -13,7 +13,8 @@ module.exports = {
|
|||
rules: [
|
||||
{
|
||||
test: /.jsx?$/,
|
||||
loader: 'babel-loader'
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue