datepicker with timezone

This commit is contained in:
Dani Herrero 2017-07-13 08:58:48 +02:00
parent 3cf33fe48b
commit a06ac62b91
1 changed files with 4 additions and 3 deletions

View File

@ -63,7 +63,7 @@ class DatePicker extends Component {
} }
_formatFlat2Angular(string) { // change string Flatpickr format to angular format (d-m-Y -> dd-MM-yyyy) _formatFlat2Angular(string) { // change string Flatpickr format to angular format (d-m-Y -> dd-MM-yyyy)
let aux = string.split(/[T.,/ :-]/); let aux = string.split((/[ZT.,/ :-]/));
let parts = []; let parts = [];
aux.forEach( aux.forEach(
val => { val => {
@ -88,8 +88,8 @@ class DatePicker extends Component {
} else if (!this.iniOpts.dateFormat || (this.iniOpts.dateFormat && this.iniOpts.dateFormat.startsWith('Y-m-d'))) { } else if (!this.iniOpts.dateFormat || (this.iniOpts.dateFormat && this.iniOpts.dateFormat.startsWith('Y-m-d'))) {
model = value; model = value;
} else { } else {
let formats = this.iniOpts.dateFormat.split(/[T.,/ :-]/); let formats = this.iniOpts.dateFormat.split((/[ZT.,/ :-]/));
let aux = value.split(/[T.,/ :-]/); let aux = value.split((/[ZT.,/ :-]/));
let date = {}; let date = {};
formats.forEach( formats.forEach(
(k, i) => { (k, i) => {
@ -129,6 +129,7 @@ class DatePicker extends Component {
} }
} }
model = `${dateStr} ${hourStr}`.trim(); model = `${dateStr} ${hourStr}`.trim();
}
if (this.model !== model) { if (this.model !== model) {
this.model = model; this.model = model;