Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onRangeChange(): void {
const start = this.start ? formatDate(this.start, 'd MMMM y h:mm a', 'en-US') + ' ' + this._startTimezone.name : '';
const end = this.end ? formatDate(this.end, 'd MMMM y h:mm a', 'en-US') + ' ' + this._endTimezone.name : '';
if (!this.start || !this.end) {
return;
}
// reset the invalid state
this.invalid = false;
// check if the dates are valid
if (this.getNormalizedDate(this.start, this._startTimezone).getTime() > this.getNormalizedDate(this.end, this._endTimezone).getTime()) {
this.invalid = true;
}
// concatenate the two dates
this.date = start && end ? `${start} — ${end}` : start || end;
eventRender.subscribe(() => {
renderedImg++;
if (renderedImg === this.chartPDF.length) {
doc.deletePage(this.chartPDF.length + 1);
// tslint:disable-next-line:max-line-length
doc.save(`Report ${DataType[this.selectedType]} Period ${formatDate(this.dateFrom, 'dd/MM/yy HH:mm', 'en-US')} - ${formatDate(this.dateTo, 'dd/MM/yy HH:mm', 'en-US')}`);
}
});
}
readableHour(startStr : string, endStr : string) : string {
let start = new Date(), end = new Date();
var slot = startStr.split('-');
start.setMonth(Number(slot[1]) - 1, Number(slot[2]));
start.setHours(Number(slot[3]), Number(slot[4]));
slot = endStr.split('-');
end.setMonth(Number(slot[1]) - 1, Number(slot[2]));
end.setHours(Number(slot[3]), Number(slot[4]));
var tail = formatDate(start, "hh:mm aa", "en-US");
tail += " to " + formatDate(end, "hh:mm aa", "en-US");
if(start.getDay() != end.getDay())
{
tail += "(tmw)";
}
return tail;
}
readableHour(startStr : string, endStr : string) : string {
let start = new Date(), end = new Date();
var slot = startStr.split('-');
start.setMonth(Number(slot[1]) - 1, Number(slot[2]));
start.setHours(Number(slot[3]), Number(slot[4]));
slot = endStr.split('-');
end.setMonth(Number(slot[1]) - 1, Number(slot[2]));
end.setHours(Number(slot[3]), Number(slot[4]));
var tail = formatDate(start, "hh:mm aa", "en-US");
tail += " to " + formatDate(end, "hh:mm aa", "en-US");
if(start.getDay() != end.getDay())
{
tail += "(tmw)";
}
return tail;
}
removeExpiredDisabledNotifications(notificationsStored: Array) {
const today = formatDate(new Date(), 'yyyy-MM-dd', 'en');
this.dismissedNotifications = this.dismissedNotifications.filter(notification => {
return formatDate(notification.expiration, 'yyyy-MM-dd', 'en') > today;
});
localStorage.setItem(this.storageKey, JSON.stringify(this.dismissedNotifications));
}
if (this.dates.length > 0) {
let minDate = 0;
let maxDate = 0;
this.dates.forEach((date) => {
const dMinDate = new Date(minDate);
const dMaxDate = new Date(maxDate);
const dDate = new Date(date);
if (dDate > dMaxDate) {
maxDate = date;
}
if (dDate < dMinDate || minDate === 0) {
minDate = date;
}
});
this.summariesData["Min Date"] = formatDate(minDate, "mediumDate", "en");
this.summariesData["Max Date"] = formatDate(maxDate, "mediumDate", "en");
}
if (this.bools.length > 0) {
let trues = 0;
let falses = 0;
let count = 0;
this.bools.forEach((bool) => {
if (bool) {
trues += 1;
} else {
falses += 1;
}
});
count = trues + falses;
this.summariesData["Discontinued"] = trues + " of " + count;
}
}
public eventDescription({ event, locale }: A11yParams): string {
if (event.allDay === true) {
return this.allDayEventDescription({ event, locale });
}
const aria = `
${formatDate(event.start, 'EEEE MMMM dd', locale)},
${event.title}, from ${formatDate(event.start, 'hh:mm a', locale)}
`;
if (event.end) {
return aria + ` to ${formatDate(event.end, 'hh:mm a', locale)}`;
}
return aria;
}
dateString1 = 'y MMM d HH:mm';
}
if (
date1.getUTCMonth() === date2.getUTCMonth() &&
date1.getUTCDay() === date2.getUTCDay()
) {
dateString2 = 'HH:mm';
}
} else {
dateString1 = 'y MMM d HH:mm';
dateString2 = dateString1;
}
dateString1 = formatDate(start, dateString1, locale);
dateString2 = formatDate(end, dateString2, locale);
return `${dateString1} — ${dateString2}`;
}
this.storage.get("time_slot").then((res) => {
if(!res) {
let date = new Date();
date.setMinutes(date.getMinutes() + 30);
this.start = formatDate(date, "yyyy-MM-dd-HH-mm", 'en-US');
date.setHours(date.getHours() + 1);
this.end = formatDate(date, "yyyy-MM-dd-HH-mm", 'en-US');
} else {
this.start = res.start;
this.end = res.end;
}
})
.finally(() => {
public openDayEventsAlert({ date, locale }: A11yParams): string {
return `${formatDate(date, 'EEEE MMMM dd', locale)} expanded`;
}