offset changes
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
parent
dd4f4e39fb
commit
7a7b2c67d0
|
@ -133,14 +133,15 @@ export default class Calendar extends Component {
|
|||
date.getFullYear(),
|
||||
date.getMonth(), day);
|
||||
|
||||
this.applyOffset(newDate);
|
||||
|
||||
let event = this.events.find(event => {
|
||||
return event.date >= newDate && event.date <= newDate;
|
||||
});
|
||||
|
||||
console.log(this.events);
|
||||
console.log(newDate);
|
||||
|
||||
|
||||
/* if (curDate >= newDate && curDate <= newDate)
|
||||
color = 'orange'; */
|
||||
|
||||
|
|
|
@ -24,23 +24,6 @@ class VnMySQL extends MySQL {
|
|||
}
|
||||
}
|
||||
|
||||
fromColumnValue(prop, val) {
|
||||
if (val == null || !prop || prop.type !== Date)
|
||||
return MySQL.prototype.fromColumnValue.call(this, prop, val);
|
||||
|
||||
let date = new Date(val);
|
||||
let locale = new Date(val);
|
||||
let offset = locale.getTimezoneOffset() * 60000;
|
||||
date.setTime(date.getTime() + offset);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
isIsoDate(dateString) {
|
||||
let isoRegexp = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/g;
|
||||
return isoRegexp.test(dateString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Promisified version of execute().
|
||||
*
|
||||
|
@ -51,18 +34,6 @@ class VnMySQL extends MySQL {
|
|||
* @return {Promise} The operation promise
|
||||
*/
|
||||
executeP(query, params, options = {}, cb) {
|
||||
if (params) {
|
||||
for (let param of params) {
|
||||
if (param && typeof param.getMonth === 'function' || this.isIsoDate(param)) {
|
||||
if (this.isIsoDate(param)) param = new Date(param);
|
||||
let locale = new Date(param);
|
||||
let offset = locale.getTimezoneOffset() * 60000;
|
||||
param.setTime(param.getTime() - offset);
|
||||
console.log(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
this.execute(query, params, options, (error, response) => {
|
||||
if (cb)
|
||||
|
|
Loading…
Reference in New Issue