This commit is contained in:
@@ -40,33 +40,44 @@ export default {
|
||||
if (token == null || token.length == 0) {
|
||||
throw "relative-date-filter-calculator: date token is null or empty";
|
||||
}
|
||||
//Luxon object: window.$gz.DateTime
|
||||
|
||||
//return object contains the two dates that encompass the time period
|
||||
//the token represents to the local browser time zone but in UTC
|
||||
//and iso8601 format
|
||||
var ret = { after: undefined, before: undefined };
|
||||
var dtNow = window.$gz.DateTime.local();
|
||||
var dtToday = window.$gz.DateTime.local(dtNow.year, dtNow.month, dtNow.day);
|
||||
|
||||
var dtStart = window.$gz.DateTime.local()
|
||||
.toUTC()
|
||||
.toString();
|
||||
var dtEnd = window.$gz.DateTime.local().toString();
|
||||
switch (token) {
|
||||
case "*yesterday*":
|
||||
//Between Day before yesterday at midnight and yesterday at midnight
|
||||
// dtAfter = RelativeToday.AddDays(-1);
|
||||
// dtAfter = dtAfter.AddSeconds(-1);
|
||||
// dtBefore = RelativeToday;//.AddDays(-1);
|
||||
ret.after = dtToday
|
||||
.plus({ days: -1, seconds: -1 })
|
||||
.toUTC()
|
||||
.toString();
|
||||
ret.before = dtToday.toUTC().toString();
|
||||
break;
|
||||
case "*today*":
|
||||
//Between yesterday at midnight and tommorow at midnight
|
||||
ret.after = dtToday
|
||||
.plus({ seconds: -1 })
|
||||
.toUTC()
|
||||
.toString();
|
||||
ret.before = dtToday
|
||||
.plus({ days: 1 })
|
||||
.toUTC()
|
||||
.toString();
|
||||
break;
|
||||
}
|
||||
|
||||
return { after: dtStart, before: dtEnd };
|
||||
return ret;
|
||||
}
|
||||
|
||||
//new functions above here
|
||||
};
|
||||
//LUXON MATH: https://moment.github.io/luxon/docs/manual/zones.html#math-across-dsts
|
||||
//https://moment.github.io/luxon/docs/manual/math.html
|
||||
//luxon api ref: https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html
|
||||
|
||||
// //############################################################### OLD SERVER FILTERING CODE ##########################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user