Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set maxDate(date = undefined) {
this.datePicker.maxDate = dateUtils.parse(date, this.dateFormat);
return this;
}
// Get maxDate
var truncAndShiftDate = function(d,period){
var vtp = valueTimePattern[period];
return shift[period](date.parse(date.format(new Date(d),vtp),vtp))
}
render() {
let d = this.date;
if(date.isValid(this.date, SERVER_DATE_FORMAT)){
d = date.format(date.parse(this.date, SERVER_DATE_FORMAT), 'YYYY');
}
return html`
<style>
:host{
text-align: left;
}
.card{
display: inline-block;
width: ${ this.width || '230px'};
height: 0;
margin: 8px;
position: relative;
cursor: pointer;
text-decoration: none;
}</style>
return src.map(function(item){
var t = item.DATE.toString()
+ ":"
+ item.HOUR.toString()
+":0";
return {
"#value":item.AVG,
"indicator":indicators[id].label,
"#indicator":id,
"time": date.parse(t,"YYYYMMDD:H:m"),
"#time": date.parse(t,"YYYYMMDD:H:m")
}
})
}
var getTimePointsFromIndicators = function(indicators, fromT, toT) {
var timePointsSet = new Set();
for(var varName in indicators) {
var varIndicators = indicators[varName];
for(var valueName in varIndicators) {
var indicator = varIndicators[valueName];
var sDate = date.parse(indicator.start.stamp,
indicator.start.format);
var eDate = date.parse(indicator.end.stamp,
indicator.end.format)
var fromDate = date.parse(fromT.stamp, fromT.format);
var toDate = date.parse(toT.stamp, toT.format);
var pDuration = indicator.period ? new Duration(indicator.period) : undefined;
if (pDuration) {
interval = findPeriodicalIntervalFor(fromDate, sDate, eDate, pDuration);
var period = pDuration.milliseconds();
if (!isInInterval(interval.sDate, fromDate, toDate) &&
!isInInterval(interval.eDate, fromDate, toDate) ) {
sDate = date.addMilliseconds(interval.sDate, period);
eDate = date.addMilliseconds(interval.eDate, period);
} else if (isInInterval(date.addMilliseconds(interval.eDate, -period), fromDate, toDate)) {
sDate = date.addMilliseconds(interval.sDate, -period);
eDate = date.addMilliseconds(interval.eDate, -period);
} else {
sDate = interval.sDate;
set startDate(date = undefined) {
this.datePicker.start = dateUtils.parse(date, this.dateFormat);
return this;
}
get startDate() {
getEvidences: function(t) {
var evidences = {};
for(var varName in this.indicators) {
evidences[varName] = {};
var varIndicators = this.indicators[varName];
for(var valueName in varIndicators) {
var indicator = varIndicators[valueName];
var sDate = date.parse(indicator.start.stamp,
indicator.start.format);
var eDate = date.parse(indicator.end.stamp,
indicator.end.format)
var tDate = date.parse(t.stamp, t.format);
if (indicator.period) {
interval = findPeriodicalIntervalFor(tDate, sDate, eDate, new Duration(indicator.period));
sDate = interval.sDate;
eDate = interval.eDate;
}
if (isInInterval(tDate, sDate, eDate)) {
if (!indicator.distribution) {
evidences[varName] = valueName;
break;
}
var distr = indicator.distribution;
for(var i=distr.length-1; i >=0; i--) {
var fromStart = new Duration(distr[i].fromStart).milliseconds();
var iDate = date.addMilliseconds(sDate, fromStart);
getEvidences: function(t) {
var evidences = {};
for(var varName in this.indicators) {
evidences[varName] = {};
var varIndicators = this.indicators[varName];
for(var valueName in varIndicators) {
var indicator = varIndicators[valueName];
var sDate = date.parse(indicator.start.stamp,
indicator.start.format);
var eDate = date.parse(indicator.end.stamp,
indicator.end.format)
var tDate = date.parse(t.stamp, t.format);
if (indicator.period) {
interval = findPeriodicalIntervalFor(tDate, sDate, eDate, new Duration(indicator.period));
sDate = interval.sDate;
eDate = interval.eDate;
}
if (isInInterval(tDate, sDate, eDate)) {
if (!indicator.distribution) {
evidences[varName] = valueName;
break;
}
var distr = indicator.distribution;
for(var i=distr.length-1; i >=0; i--) {
var truncDate = function(d,period){
return date.parse(date.format(new Date(d),period),period)
}
set endDate(date = undefined) {
this.datePicker.end = dateUtils.parse(date, this.dateFormat);
return this;
}
get endDate() {