This commit is contained in:
@@ -66,7 +66,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||||
var parsedDate = new Date(value);
|
let parsedDate = new Date(value);
|
||||||
|
|
||||||
//is it a valid date?
|
//is it a valid date?
|
||||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||||
@@ -95,7 +95,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||||
var parsedDate = new Date(value);
|
let parsedDate = new Date(value);
|
||||||
|
|
||||||
//is it a valid date?
|
//is it a valid date?
|
||||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||||
@@ -126,7 +126,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||||
var parsedDate = new Date(value);
|
let parsedDate = new Date(value);
|
||||||
|
|
||||||
//is it a valid date?
|
//is it a valid date?
|
||||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default {
|
|||||||
// called once from app.vue only
|
// called once from app.vue only
|
||||||
//
|
//
|
||||||
wireUpEventHandlers(vm) {
|
wireUpEventHandlers(vm) {
|
||||||
var self = this;
|
let self = this;
|
||||||
//expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] }
|
//expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] }
|
||||||
window.$gz.eventBus.$on("openobject", function handleOpenObjectClickHandler(
|
window.$gz.eventBus.$on("openobject", function handleOpenObjectClickHandler(
|
||||||
tid
|
tid
|
||||||
|
|||||||
@@ -22,9 +22,11 @@ export default {
|
|||||||
|
|
||||||
//NOTE: it's valid for one of the two ret values might be undefined as it's valid to have a single date for
|
//NOTE: it's valid for one of the two ret values might be undefined as it's valid to have a single date for
|
||||||
//Past or Future
|
//Past or Future
|
||||||
var ret = { after: undefined, before: undefined };
|
let ret = { after: undefined, before: undefined };
|
||||||
var dtNow = window.$gz.DateTime.local();
|
let dtNow = window.$gz.DateTime.local();
|
||||||
var dtToday = window.$gz.DateTime.local(dtNow.year, dtNow.month, dtNow.day);
|
let dtToday = window.$gz.DateTime.local(dtNow.year, dtNow.month, dtNow.day);
|
||||||
|
let dtAfter = null;
|
||||||
|
let dtBefore = null;
|
||||||
|
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case "*yesterday*":
|
case "*yesterday*":
|
||||||
@@ -64,13 +66,13 @@ export default {
|
|||||||
//Between two Sundays ago at midnight and last sunday at midnight
|
//Between two Sundays ago at midnight and last sunday at midnight
|
||||||
|
|
||||||
//go back a week
|
//go back a week
|
||||||
var dtAfter = dtToday.plus({ days: -7 });
|
dtAfter = dtToday.plus({ days: -7 });
|
||||||
//go backwards to Sunday (In Luxon Monday is 1, Sunday is 7)
|
//go backwards to Sunday (In Luxon Monday is 1, Sunday is 7)
|
||||||
while (dtAfter.weekday != 7) {
|
while (dtAfter.weekday != 7) {
|
||||||
dtAfter = dtAfter.plus({ days: -1 });
|
dtAfter = dtAfter.plus({ days: -1 });
|
||||||
}
|
}
|
||||||
//go to very start of eighth dayahead
|
//go to very start of eighth dayahead
|
||||||
var dtBefore = dtAfter.plus({ days: 8 });
|
dtBefore = dtAfter.plus({ days: 8 });
|
||||||
//remove a second for boundary
|
//remove a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
//set return values from calculated values
|
//set return values from calculated values
|
||||||
@@ -82,7 +84,7 @@ export default {
|
|||||||
//Between Sunday at midnight and Next sunday at midnight
|
//Between Sunday at midnight and Next sunday at midnight
|
||||||
|
|
||||||
//Start with today
|
//Start with today
|
||||||
var dtAfter = dtToday;
|
dtAfter = dtToday;
|
||||||
//SET dtAfter to Monday start of this week
|
//SET dtAfter to Monday start of this week
|
||||||
//go backwards to monday (In Luxon Monday is 1, Sunday is 7)
|
//go backwards to monday (In Luxon Monday is 1, Sunday is 7)
|
||||||
while (dtAfter.weekday != 1) {
|
while (dtAfter.weekday != 1) {
|
||||||
@@ -92,7 +94,7 @@ export default {
|
|||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
|
|
||||||
//Start with today
|
//Start with today
|
||||||
var dtBefore = dtToday;
|
dtBefore = dtToday;
|
||||||
|
|
||||||
//SET dtBefore to next monday
|
//SET dtBefore to next monday
|
||||||
//is it monday now?
|
//is it monday now?
|
||||||
@@ -114,7 +116,7 @@ export default {
|
|||||||
//Between Next Sunday at midnight and Next Next sunday at midnight
|
//Between Next Sunday at midnight and Next Next sunday at midnight
|
||||||
|
|
||||||
//Start with today
|
//Start with today
|
||||||
var dtAfter = dtToday;
|
dtAfter = dtToday;
|
||||||
//If today is monday skip over it first, we're looking for *next* monday, not this one
|
//If today is monday skip over it first, we're looking for *next* monday, not this one
|
||||||
if (dtAfter.weekday == 1) {
|
if (dtAfter.weekday == 1) {
|
||||||
dtAfter = dtAfter.plus({ days: 1 });
|
dtAfter = dtAfter.plus({ days: 1 });
|
||||||
@@ -129,7 +131,7 @@ export default {
|
|||||||
|
|
||||||
//set dtBefore 7 days ahead of dtAfter
|
//set dtBefore 7 days ahead of dtAfter
|
||||||
//(sb BEFORE two mondays from now at zero hour so need to add a second due to prior removal of a second to make sunday)
|
//(sb BEFORE two mondays from now at zero hour so need to add a second due to prior removal of a second to make sunday)
|
||||||
var dtBefore = dtAfter.plus({ days: 7, seconds: 1 });
|
dtBefore = dtAfter.plus({ days: 7, seconds: 1 });
|
||||||
|
|
||||||
//set return values from calculated values
|
//set return values from calculated values
|
||||||
ret.after = dtAfter.toUTC().toString();
|
ret.after = dtAfter.toUTC().toString();
|
||||||
@@ -138,11 +140,11 @@ export default {
|
|||||||
|
|
||||||
case "*lastmonth*":
|
case "*lastmonth*":
|
||||||
//start with the first day of this month
|
//start with the first day of this month
|
||||||
var dtAfter = window.$gz.DateTime.local(dtNow.year, dtNow.month, 1);
|
dtAfter = window.$gz.DateTime.local(dtNow.year, dtNow.month, 1);
|
||||||
//subtract a Month
|
//subtract a Month
|
||||||
dtAfter = dtAfter.plus({ months: -1 });
|
dtAfter = dtAfter.plus({ months: -1 });
|
||||||
//Add one month to dtAfter to get end date
|
//Add one month to dtAfter to get end date
|
||||||
var dtBefore = dtAfter.plus({ months: 1 });
|
dtBefore = dtAfter.plus({ months: 1 });
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
|
|
||||||
@@ -153,9 +155,9 @@ export default {
|
|||||||
|
|
||||||
case "*thismonth*":
|
case "*thismonth*":
|
||||||
//start with the first day of this month
|
//start with the first day of this month
|
||||||
var dtAfter = window.$gz.DateTime.local(dtNow.year, dtNow.month, 1);
|
dtAfter = window.$gz.DateTime.local(dtNow.year, dtNow.month, 1);
|
||||||
//Add one month to dtAfter to get end date
|
//Add one month to dtAfter to get end date
|
||||||
var dtBefore = dtAfter.plus({ months: 1 });
|
dtBefore = dtAfter.plus({ months: 1 });
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
|
|
||||||
@@ -166,13 +168,13 @@ export default {
|
|||||||
|
|
||||||
case "*nextmonth*":
|
case "*nextmonth*":
|
||||||
//start with the first day of this month
|
//start with the first day of this month
|
||||||
var dtAfter = window.$gz.DateTime.local(dtNow.year, dtNow.month, 1);
|
dtAfter = window.$gz.DateTime.local(dtNow.year, dtNow.month, 1);
|
||||||
|
|
||||||
//add a month
|
//add a month
|
||||||
dtAfter = dtAfter.plus({ months: 1 });
|
dtAfter = dtAfter.plus({ months: 1 });
|
||||||
|
|
||||||
//Add one month to dtAfter to get end date
|
//Add one month to dtAfter to get end date
|
||||||
var dtBefore = dtAfter.plus({ months: 1 });
|
dtBefore = dtAfter.plus({ months: 1 });
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -184,13 +186,13 @@ export default {
|
|||||||
|
|
||||||
case "*14daywindow*":
|
case "*14daywindow*":
|
||||||
//Start with today
|
//Start with today
|
||||||
var dtAfter = dtToday;
|
dtAfter = dtToday;
|
||||||
|
|
||||||
//subtract 7 days
|
//subtract 7 days
|
||||||
dtAfter = dtAfter.plus({ days: -7 });
|
dtAfter = dtAfter.plus({ days: -7 });
|
||||||
|
|
||||||
//Add 15 days to dtAfter to get end date
|
//Add 15 days to dtAfter to get end date
|
||||||
var dtBefore = dtAfter.plus({ days: 15 });
|
dtBefore = dtAfter.plus({ days: 15 });
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -217,13 +219,13 @@ export default {
|
|||||||
case "*lastyear*":
|
case "*lastyear*":
|
||||||
//"last year" means prior calendar year from start of january to end of december
|
//"last year" means prior calendar year from start of january to end of december
|
||||||
//start with the first day of this year
|
//start with the first day of this year
|
||||||
var dtAfter = window.$gz.DateTime.local(dtNow.year);
|
dtAfter = window.$gz.DateTime.local(dtNow.year);
|
||||||
|
|
||||||
//subtract a year
|
//subtract a year
|
||||||
dtAfter = dtAfter.plus({ years: -1 });
|
dtAfter = dtAfter.plus({ years: -1 });
|
||||||
|
|
||||||
//Before zero hour january 1st this year
|
//Before zero hour january 1st this year
|
||||||
var dtBefore = window.$gz.DateTime.local(dtNow.year);
|
dtBefore = window.$gz.DateTime.local(dtNow.year);
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -236,10 +238,10 @@ export default {
|
|||||||
case "*thisyear*":
|
case "*thisyear*":
|
||||||
//From zero hour january 1 this year (minus a second) to zero hour jan 1 next year
|
//From zero hour january 1 this year (minus a second) to zero hour jan 1 next year
|
||||||
//start with the first day of this year
|
//start with the first day of this year
|
||||||
var dtAfter = window.$gz.DateTime.local(dtNow.year);
|
dtAfter = window.$gz.DateTime.local(dtNow.year);
|
||||||
|
|
||||||
//Before zero hour january 1st next year
|
//Before zero hour january 1st next year
|
||||||
var dtBefore = window.$gz.DateTime.local(dtNow.year);
|
dtBefore = window.$gz.DateTime.local(dtNow.year);
|
||||||
dtBefore = dtBefore.plus({ years: 1 });
|
dtBefore = dtBefore.plus({ years: 1 });
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
@@ -252,10 +254,10 @@ export default {
|
|||||||
|
|
||||||
case "*last3months*":
|
case "*last3months*":
|
||||||
//From Now minus 3 months
|
//From Now minus 3 months
|
||||||
var dtAfter = dtToday.plus({ months: -3 });
|
dtAfter = dtToday.plus({ months: -3 });
|
||||||
|
|
||||||
//Before now
|
//Before now
|
||||||
var dtBefore = dtNow;
|
dtBefore = dtNow;
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -267,10 +269,10 @@ export default {
|
|||||||
|
|
||||||
case "*last6months*":
|
case "*last6months*":
|
||||||
//From Now minus 6 months
|
//From Now minus 6 months
|
||||||
var dtAfter = dtToday.plus({ months: -6 });
|
dtAfter = dtToday.plus({ months: -6 });
|
||||||
|
|
||||||
//Before now
|
//Before now
|
||||||
var dtBefore = dtNow;
|
dtBefore = dtNow;
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -282,10 +284,10 @@ export default {
|
|||||||
|
|
||||||
case "*pastyear*": //within the prior 365 days before today
|
case "*pastyear*": //within the prior 365 days before today
|
||||||
//From Now minus 365 days
|
//From Now minus 365 days
|
||||||
var dtAfter = dtToday.plus({ days: -365 });
|
dtAfter = dtToday.plus({ days: -365 });
|
||||||
|
|
||||||
//Before now
|
//Before now
|
||||||
var dtBefore = dtNow;
|
dtBefore = dtNow;
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -297,10 +299,10 @@ export default {
|
|||||||
|
|
||||||
case "*past90days*":
|
case "*past90days*":
|
||||||
//From Now minus 90 days
|
//From Now minus 90 days
|
||||||
var dtAfter = dtNow.plus({ days: -90 });
|
dtAfter = dtNow.plus({ days: -90 });
|
||||||
|
|
||||||
//Before now
|
//Before now
|
||||||
var dtBefore = dtNow;
|
dtBefore = dtNow;
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -312,10 +314,10 @@ export default {
|
|||||||
|
|
||||||
case "*past30days*":
|
case "*past30days*":
|
||||||
//From Now minus 30 days
|
//From Now minus 30 days
|
||||||
var dtAfter = dtNow.plus({ days: -30 });
|
dtAfter = dtNow.plus({ days: -30 });
|
||||||
|
|
||||||
//Before now
|
//Before now
|
||||||
var dtBefore = dtNow;
|
dtBefore = dtNow;
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -327,10 +329,10 @@ export default {
|
|||||||
|
|
||||||
case "*past24hours*":
|
case "*past24hours*":
|
||||||
//From Now minus 24 hours
|
//From Now minus 24 hours
|
||||||
var dtAfter = dtNow.plus({ hours: -24 });
|
dtAfter = dtNow.plus({ hours: -24 });
|
||||||
|
|
||||||
//Before now
|
//Before now
|
||||||
var dtBefore = dtNow;
|
dtBefore = dtNow;
|
||||||
|
|
||||||
//move after back a second for boundary
|
//move after back a second for boundary
|
||||||
dtAfter = dtAfter.plus({ seconds: -1 });
|
dtAfter = dtAfter.plus({ seconds: -1 });
|
||||||
@@ -376,7 +378,7 @@ export default {
|
|||||||
// //Fetch useroptions object and relative time offset
|
// //Fetch useroptions object and relative time offset
|
||||||
// //See servers spec doc core-locale-currency-numbers-time-and-dates.txt for details about why this is necessary to be done this way
|
// //See servers spec doc core-locale-currency-numbers-time-and-dates.txt for details about why this is necessary to be done this way
|
||||||
// AyaNova.Models.AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext;
|
// AyaNova.Models.AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext;
|
||||||
// var u = ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { tz = m.UserOptions.TimeZoneOffset }).First();
|
// let u = ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { tz = m.UserOptions.TimeZoneOffset }).First();
|
||||||
|
|
||||||
// //Add this value to any time's hours to convert to user local time
|
// //Add this value to any time's hours to convert to user local time
|
||||||
// Double TimeZoneAdjustment = ((double)u.tz) * -1;
|
// Double TimeZoneAdjustment = ((double)u.tz) * -1;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ export default {
|
|||||||
//step 1: build an array of keys that we don't have already
|
//step 1: build an array of keys that we don't have already
|
||||||
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
|
//Note: this will ensure only unique keys go into the store so it's safe to call this with dupes as can happen
|
||||||
//for example datatables have dynamic column names so they need to fetch on demand
|
//for example datatables have dynamic column names so they need to fetch on demand
|
||||||
var needIt = [];
|
let needIt = [];
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
if (
|
if (
|
||||||
!window.$gz._.has(window.$gz.store.state.translationText, keys[i])
|
!window.$gz._.has(window.$gz.store.state.translationText, keys[i])
|
||||||
) {
|
) {
|
||||||
@@ -167,13 +167,13 @@ export default {
|
|||||||
//translate each and return the string translated
|
//translate each and return the string translated
|
||||||
//
|
//
|
||||||
translateString(s) {
|
translateString(s) {
|
||||||
var ret = s;
|
let ret = s;
|
||||||
var pattern = /\[(.*?)\]/g;
|
let pattern = /\[(.*?)\]/g;
|
||||||
var match;
|
let match;
|
||||||
while ((match = pattern.exec(s)) != null) {
|
while ((match = pattern.exec(s)) != null) {
|
||||||
var foundMatch = match[0];
|
let foundMatch = match[0];
|
||||||
var tKey = match[1];
|
let tKey = match[1];
|
||||||
var newValue = this.get(tKey);
|
let newValue = this.get(tKey);
|
||||||
ret = ret.replace(foundMatch, newValue);
|
ret = ret.replace(foundMatch, newValue);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user