This commit is contained in:
2020-04-02 14:18:28 +00:00
parent fbe647a799
commit a81ee7d204
4 changed files with 48 additions and 46 deletions

View File

@@ -66,7 +66,7 @@ export default {
}
//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?
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")
var parsedDate = new Date(value);
let parsedDate = new Date(value);
//is it a valid date?
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")
var parsedDate = new Date(value);
let parsedDate = new Date(value);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {

View File

@@ -34,7 +34,7 @@ export default {
// called once from app.vue only
//
wireUpEventHandlers(vm) {
var self = this;
let self = this;
//expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] }
window.$gz.eventBus.$on("openobject", function handleOpenObjectClickHandler(
tid

View File

@@ -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
//Past or Future
var ret = { after: undefined, before: undefined };
var dtNow = window.$gz.DateTime.local();
var dtToday = window.$gz.DateTime.local(dtNow.year, dtNow.month, dtNow.day);
let ret = { after: undefined, before: undefined };
let dtNow = window.$gz.DateTime.local();
let dtToday = window.$gz.DateTime.local(dtNow.year, dtNow.month, dtNow.day);
let dtAfter = null;
let dtBefore = null;
switch (token) {
case "*yesterday*":
@@ -64,13 +66,13 @@ export default {
//Between two Sundays ago at midnight and last sunday at midnight
//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)
while (dtAfter.weekday != 7) {
dtAfter = dtAfter.plus({ days: -1 });
}
//go to very start of eighth dayahead
var dtBefore = dtAfter.plus({ days: 8 });
dtBefore = dtAfter.plus({ days: 8 });
//remove a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
//set return values from calculated values
@@ -82,7 +84,7 @@ export default {
//Between Sunday at midnight and Next sunday at midnight
//Start with today
var dtAfter = dtToday;
dtAfter = dtToday;
//SET dtAfter to Monday start of this week
//go backwards to monday (In Luxon Monday is 1, Sunday is 7)
while (dtAfter.weekday != 1) {
@@ -92,7 +94,7 @@ export default {
dtAfter = dtAfter.plus({ seconds: -1 });
//Start with today
var dtBefore = dtToday;
dtBefore = dtToday;
//SET dtBefore to next monday
//is it monday now?
@@ -114,7 +116,7 @@ export default {
//Between Next Sunday at midnight and Next Next sunday at midnight
//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 (dtAfter.weekday == 1) {
dtAfter = dtAfter.plus({ days: 1 });
@@ -129,7 +131,7 @@ export default {
//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)
var dtBefore = dtAfter.plus({ days: 7, seconds: 1 });
dtBefore = dtAfter.plus({ days: 7, seconds: 1 });
//set return values from calculated values
ret.after = dtAfter.toUTC().toString();
@@ -138,11 +140,11 @@ export default {
case "*lastmonth*":
//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
dtAfter = dtAfter.plus({ months: -1 });
//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
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -153,9 +155,9 @@ export default {
case "*thismonth*":
//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
var dtBefore = dtAfter.plus({ months: 1 });
dtBefore = dtAfter.plus({ months: 1 });
//move after back a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -166,13 +168,13 @@ export default {
case "*nextmonth*":
//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
dtAfter = dtAfter.plus({ months: 1 });
//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
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -184,13 +186,13 @@ export default {
case "*14daywindow*":
//Start with today
var dtAfter = dtToday;
dtAfter = dtToday;
//subtract 7 days
dtAfter = dtAfter.plus({ days: -7 });
//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
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -217,13 +219,13 @@ export default {
case "*lastyear*":
//"last year" means prior calendar year from start of january to end of december
//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
dtAfter = dtAfter.plus({ years: -1 });
//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
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -236,10 +238,10 @@ export default {
case "*thisyear*":
//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
var dtAfter = window.$gz.DateTime.local(dtNow.year);
dtAfter = window.$gz.DateTime.local(dtNow.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 });
//move after back a second for boundary
@@ -252,10 +254,10 @@ export default {
case "*last3months*":
//From Now minus 3 months
var dtAfter = dtToday.plus({ months: -3 });
dtAfter = dtToday.plus({ months: -3 });
//Before now
var dtBefore = dtNow;
dtBefore = dtNow;
//move after back a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -267,10 +269,10 @@ export default {
case "*last6months*":
//From Now minus 6 months
var dtAfter = dtToday.plus({ months: -6 });
dtAfter = dtToday.plus({ months: -6 });
//Before now
var dtBefore = dtNow;
dtBefore = dtNow;
//move after back a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -282,10 +284,10 @@ export default {
case "*pastyear*": //within the prior 365 days before today
//From Now minus 365 days
var dtAfter = dtToday.plus({ days: -365 });
dtAfter = dtToday.plus({ days: -365 });
//Before now
var dtBefore = dtNow;
dtBefore = dtNow;
//move after back a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -297,10 +299,10 @@ export default {
case "*past90days*":
//From Now minus 90 days
var dtAfter = dtNow.plus({ days: -90 });
dtAfter = dtNow.plus({ days: -90 });
//Before now
var dtBefore = dtNow;
dtBefore = dtNow;
//move after back a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -312,10 +314,10 @@ export default {
case "*past30days*":
//From Now minus 30 days
var dtAfter = dtNow.plus({ days: -30 });
dtAfter = dtNow.plus({ days: -30 });
//Before now
var dtBefore = dtNow;
dtBefore = dtNow;
//move after back a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -327,10 +329,10 @@ export default {
case "*past24hours*":
//From Now minus 24 hours
var dtAfter = dtNow.plus({ hours: -24 });
dtAfter = dtNow.plus({ hours: -24 });
//Before now
var dtBefore = dtNow;
dtBefore = dtNow;
//move after back a second for boundary
dtAfter = dtAfter.plus({ seconds: -1 });
@@ -376,7 +378,7 @@ export default {
// //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
// 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
// Double TimeZoneAdjustment = ((double)u.tz) * -1;

View File

@@ -14,8 +14,8 @@ export default {
//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
//for example datatables have dynamic column names so they need to fetch on demand
var needIt = [];
for (var i = 0; i < keys.length; i++) {
let needIt = [];
for (let i = 0; i < keys.length; i++) {
if (
!window.$gz._.has(window.$gz.store.state.translationText, keys[i])
) {
@@ -167,13 +167,13 @@ export default {
//translate each and return the string translated
//
translateString(s) {
var ret = s;
var pattern = /\[(.*?)\]/g;
var match;
let ret = s;
let pattern = /\[(.*?)\]/g;
let match;
while ((match = pattern.exec(s)) != null) {
var foundMatch = match[0];
var tKey = match[1];
var newValue = this.get(tKey);
let foundMatch = match[0];
let tKey = match[1];
let newValue = this.get(tKey);
ret = ret.replace(foundMatch, newValue);
}
return ret;