This commit is contained in:
@@ -776,7 +776,6 @@ MID CENTURY MODERN TUNES - https://www.allmusic.com/album/ultra-lounge-vol-14-bo
|
||||
|
||||
|
||||
|
||||
|
||||
BUILD 131 CHANGES OF NOTE
|
||||
|
||||
- case 3946 at a glance wiki present implemented
|
||||
|
||||
@@ -79,82 +79,27 @@ export default {
|
||||
///////////////////////////////////////////
|
||||
// Turn a utc date into a vueitfy calendar
|
||||
// schedule control compatible format
|
||||
// localized:
|
||||
//
|
||||
// localized.
|
||||
// For ease of use in schedule the epoch (milliseconds) is the best format
|
||||
// "It must be a Date, number of seconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm. Zero-padding is optional and seconds are ignored.""
|
||||
//
|
||||
//
|
||||
utcDateToScheduleCompatibleFormatLocalized(
|
||||
value,
|
||||
timeZoneName,
|
||||
languageName,
|
||||
hour12
|
||||
) {
|
||||
utcDateToScheduleCompatibleFormatLocalized(value, timeZoneName) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getResolvedTimeZoneName();
|
||||
}
|
||||
if (!languageName) {
|
||||
languageName = this.getResolvedLanguage();
|
||||
}
|
||||
|
||||
if (!hour12) {
|
||||
hour12 = this.getHour12();
|
||||
}
|
||||
|
||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||
let parsedDate = new Date(value);
|
||||
|
||||
//is it a valid date?
|
||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||
if (window.$gz.dev) {
|
||||
throw new Error(
|
||||
`locale::utcDateToScheduleCompatibleFormatLocalized - Value '${value}' is not parseable`
|
||||
`locale::utcDateToScheduleCompatibleFormatLocalized - Value is empty`
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//return this:
|
||||
//YYYY-MM-DD hh:mm
|
||||
|
||||
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts
|
||||
let formatter = new Intl.DateTimeFormat(languageName, {
|
||||
year: "numeric",
|
||||
month: "numeric",
|
||||
day: "numeric",
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
hour12: false,
|
||||
timeZone: timeZoneName
|
||||
});
|
||||
const parts = formatter.formatToParts(parsedDate);
|
||||
|
||||
let p = { year: null, month: null, day: null, hour: null, minute: null };
|
||||
parts.forEach(x => {
|
||||
switch (x.type) {
|
||||
case "year":
|
||||
case "relatedYear":
|
||||
p.year = x.value;
|
||||
break;
|
||||
case "month":
|
||||
p.month = x.value;
|
||||
break;
|
||||
case "day":
|
||||
p.day = x.value;
|
||||
break;
|
||||
case "hour":
|
||||
p.hour = x.value;
|
||||
break;
|
||||
case "minute":
|
||||
p.minute = x.value;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return `${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}`;
|
||||
return new Date(
|
||||
//sv-SE is iso-8601 format so cleanest to parse accurately
|
||||
new Date(value).toLocaleString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
})
|
||||
).getTime();
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Turn a utc date into a displayable
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div v-if="formState.ready" v-resize="onResize" class="my-n8">
|
||||
<!-- `{{ "focus:" + focus }}` {{ diagInfo() }}
|
||||
{{ evInfo }}-->
|
||||
{{ events }}
|
||||
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
||||
|
||||
<v-sheet height="64">
|
||||
@@ -265,6 +266,9 @@ SETTINGS:
|
||||
https://vuetifyjs.com/en/components/calendars/#drag-and-drop
|
||||
https://vuetifyjs.com/en/components/floating-action-buttons/#speed-dial
|
||||
|
||||
issues:
|
||||
drag losing end time for event
|
||||
|
||||
|
||||
Test: overlapping sched items that start or end outside of view
|
||||
this is a test of the query in schedulecontroller at server
|
||||
@@ -393,12 +397,19 @@ export default {
|
||||
//console.log("mouseMove got time:", mouse);
|
||||
|
||||
if (this.dragEvent && this.dragTime !== null) {
|
||||
// console.log("mosueMove:A", {
|
||||
// dragEvent: this.dragEvent,
|
||||
// dragTime: this.dragTime
|
||||
// });
|
||||
console.log("mosueMove:A", {
|
||||
dragEvent: JSON.stringify(this.dragEvent),
|
||||
dragTime: JSON.stringify(this.dragTime)
|
||||
});
|
||||
//new Date(this.dragEvent.start).getTime();
|
||||
const start = this.dragEvent.start;
|
||||
const end = this.dragEvent.end;
|
||||
// if (typeof start == "string") {
|
||||
// start = new Date(start).getTime();
|
||||
// }
|
||||
// if (typeof end == "string") {
|
||||
// end = new Date(end).getTime();
|
||||
// }
|
||||
const duration = end - start;
|
||||
const newStartTime = mouse - this.dragTime;
|
||||
|
||||
@@ -409,7 +420,7 @@ export default {
|
||||
this.dragEvent.start = newStart;
|
||||
this.dragEvent.end = newEnd;
|
||||
} else if (this.createEvent && this.createStart !== null) {
|
||||
//console.log("mosueMove:B");
|
||||
console.log("mosueMove:B");
|
||||
const mouseRounded = this.roundTime(mouse, false);
|
||||
//console.log("mouseMove mouseRounded:", mouseRounded);
|
||||
const min = Math.min(mouseRounded, this.createStart);
|
||||
@@ -429,7 +440,7 @@ export default {
|
||||
this.extendOriginal = null;
|
||||
},
|
||||
cancelDrag() {
|
||||
// console.log("cancelDrag");
|
||||
// console.log("cancelDrag");
|
||||
if (this.createEvent) {
|
||||
if (this.extendOriginal) {
|
||||
this.createEvent.end = this.extendOriginal;
|
||||
@@ -615,15 +626,11 @@ export default {
|
||||
...x,
|
||||
start: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
|
||||
x.start,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
this.hour12
|
||||
this.timeZoneName
|
||||
),
|
||||
end: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
|
||||
x.end,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
this.hour12
|
||||
this.timeZoneName
|
||||
)
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user