Exemplo n.º 1
0
 NovoSimpleCellHeader.prototype.filterData = function (filter) {
     var _this = this;
     if (this.config.filterConfig.type === 'date' && filter) {
         this.activeDateFilter = filter.label || this.labels.customDateRange;
         if (filter.startDate && filter.endDate) {
             filter = {
                 min: dateFns.startOfDay(filter.startDate),
                 max: dateFns.endOfDay(filter.endDate),
             };
         }
         else {
             filter = {
                 min: dateFns.startOfDay(dateFns.addDays(dateFns.startOfToday(), filter.min)),
                 max: dateFns.endOfDay(dateFns.addDays(dateFns.startOfToday(), filter.max)),
             };
         }
     }
     if (filter) {
         this.filter = filter;
     }
     if (this.changeTimeout) {
         clearTimeout(this.changeTimeout);
     }
     this.changeTimeout = setTimeout(function () {
         if (_this.filter === '') {
             _this.filter = undefined;
         }
         _this._sort.filter(_this.id, _this.filter, _this._config.transforms.filter);
         _this.changeDetectorRef.markForCheck();
     }, 300);
 };
Exemplo n.º 2
0
      .on('data', entry => {
        totalEntries += 1;

        const date = new Date(Math.round(entry.EdgeStartTimestamp / 1000000));

        const nextDay = startOfDay(addDays(date, 1));
        const sevenDaysLater = getSeconds(addDays(nextDay, 7));
        const thirtyDaysLater = getSeconds(addDays(nextDay, 30));
        const dayKey = stats.createDayKey(date);

        if (entry.EdgeResponseStatus === 200) {
          // Q: How many requests do we serve for a package per day?
          // Q: How many bytes do we serve for a package per day?
          const parsed = parsePackageURL(entry.ClientRequestURI);
          const packageName = parsed && parsed.packageName;

          if (packageName && isValidPackageName(packageName)) {
            incr(
              `stats-packageRequests-${dayKey}`,
              packageName,
              1,
              thirtyDaysLater
            );
            incr(
              `stats-packageBytes-${dayKey}`,
              packageName,
              entry.EdgeResponseBytes,
              thirtyDaysLater
            );
          }
        }

        // Q: How many requests per day do we receive via a protocol?
        const protocol = entry.ClientRequestProtocol;

        if (protocol) {
          incr(
            `stats-protocolRequests-${dayKey}`,
            protocol,
            1,
            thirtyDaysLater
          );
        }

        // Q: How many requests do we receive from a hostname per day?
        // Q: How many bytes do we serve to a hostname per day?
        const referer = entry.ClientRequestReferer;
        const hostname = referer && url.parse(referer).hostname;

        if (hostname) {
          incr(`stats-hostnameRequests-${dayKey}`, hostname, 1, sevenDaysLater);
          incr(
            `stats-hostnameBytes-${dayKey}`,
            hostname,
            entry.EdgeResponseBytes,
            sevenDaysLater
          );
        }
      })
Exemplo n.º 3
0
  renderDays() {
    const { weekendDate, disabledDate, inSameMonth, selected } = this.props;

    let days = [];
    for (let i = 0; i < 7; i += 1) {
      let thisDate = addDays(weekendDate, i);
      let disabled = disabledDate && disabledDate(thisDate);
      let isToday = isSameDay(thisDate, new Date());
      let classes = classNames(this.addPrefix('cell'), {
        [this.addPrefix('cell-un-same-month')]: !(inSameMonth && inSameMonth(thisDate)),
        [this.addPrefix('cell-is-today')]: isToday,
        [this.addPrefix('cell-selected')]: isSameDay(thisDate, selected),
        [this.addPrefix('cell-disabled')]: disabled
      });

      days.push(
        <div
          className={classes}
          role="menu"
          tabIndex="-1"
          title={isToday ? 'Today' : ''}
          onClick={this.handleSelect.bind(this, thisDate, disabled)}
          key={i}
        >
          <span className={this.addPrefix('cell-content')}>{getDate(thisDate)}</span>
        </div>
      );
    }
    return days;
  }
Exemplo n.º 4
0
 var _loop_2 = function (i) {
     var date = dateFns.addDays(start, i);
     if (!excluded.some(function (e) { return date.getDay() === e; })) {
         var day = getWeekDay({ date: date });
         var calEvents = getEventsInPeriod({
             events: eventsInMonth,
             periodStart: dateFns.startOfDay(date),
             periodEnd: dateFns.endOfDay(date)
         });
         day.inMonth = dateFns.isSameMonth(date, viewDate);
         day.events = calEvents;
         day.badgeTotal = calEvents.length;
         days.push(day);
     }
 };
Exemplo n.º 5
0
            return render(TMPL.week, function(_, dayIdx) {

                let dayIndexToRender = Number(dayIdx) + window.uv.weekStartsOn;
                if (dayIndexToRender === 7) {
                    dayIndexToRender = 0;
                }

                var html = '&nbsp;';

                if (dayIndexToRender === getDay(d) && m === getMonth(d)) {
                    html = renderDay(d);
                    d = addDays(d, 1);
                }

                return html;
            });
Exemplo n.º 6
0
        function renderWeekdaysHeader(date) {
            var d = startOfWeek(date);

            return render(TMPL.weekdays, {
                0: format(d, 'dd'),
                1: format(addDays(d, 1), 'dd'),
                2: format(addDays(d, 2), 'dd'),
                3: format(addDays(d, 3), 'dd'),
                4: format(addDays(d, 4), 'dd'),
                5: format(addDays(d, 5), 'dd'),
                6: format(addDays(d, 6), 'dd'),
            });
        }
Exemplo n.º 7
0
 role.role_focuses.map(focus => {
   endDate = focus.role_focus_users[0].end_date
     ? focus.role_focus_users[0].end_date
     : focus.duration && focus.role_focus_users[0].start_date
     ? addDays(
         new Date(focus.role_focus_users[0].start_date),
         focus.duration
       )
     : null
   if (endDate) {
     distance = differenceInDays(new Date(endDate), new Date())
     if (distance < daysBeforeRoleExpiration) {
       roleFocus = focus
       roleFocus.role_id = role.role_id
       roleFocus.role_name = role.role_name
       expiredRoles.push(roleFocus)
     }
   }
 })
Exemplo n.º 8
0
const WhenSection = ({ startDate, durationInDays }: Props) => {
  const startDateObj = new Date(startDate)
  const from = format(startDateObj, DATE_FORMAT)
  const to = format(addDays(startDateObj, durationInDays), DATE_FORMAT)
  const year = getYear(startDateObj)
  return (
    <SectionBg>
      <Container>
        <h2>When?</h2>
        <Lead>
          <IconCalendar size={40} />
          <span>
            {from} to {to}, {year}
          </span>
        </Lead>
        <p>Mark your calendars!</p>
      </Container>
    </SectionBg>
  )
}
Exemplo n.º 9
0
test('server api should return response with 200 status code', async t => {
  await nxmix.calendar(addDays(new Date(), -3), addDays(new Date(), -1)).then(resp => {
    t.is(resp.statusCode, 200);
    t.is(resp.body.status, 'OK');
  });
});
Exemplo n.º 10
0
	describe("adding a schedule", () => {
		const	tomorrow = format(addDays(startOfDay(new Date()), 1), "DD/MM/YYYY"),
					schedules = [
						{
							primaryAccountName: "bank account 1",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							payeeName: "Payee 1",
							amount: 1,
							debitAmount: "~$1.00",
							categoryName: "Category 13",
							subcategoryName: "Category 15",
							memo: "Basic expense",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "bank account 1",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							payeeName: "Payee 1",
							amount: 1,
							creditAmount: "~$1.00",
							categoryName: "Category 1",
							subcategoryName: "Category 3",
							memo: "Basic income",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "bank account 1",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							payeeName: "Payee 1",
							amount: 1,
							debitAmount: "~$1.00",
							categoryName: "Transfer To",
							accountName: "bank account 2",
							memo: "Transfer",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "bank account 1",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							payeeName: "Payee 1",
							amount: 2,
							debitAmount: "~$2.00",
							categoryName: "Split To",
							subtransactions: [
								{
									categoryName: "Category 13",
									subcategoryName: "Category 15",
									memo: "Sub transaction",
									rawAmount: 1,
									amount: "$1.00"
								},
								{
									categoryName: "Category 13",
									subcategoryName: "Category 15",
									memo: "Sub transaction",
									rawAmount: 1,
									amount: "$1.00"
								}
							],
							memo: "Split",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "bank account 1",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							payeeName: "Payee 1",
							amount: 2,
							debitAmount: "~$2.00",
							categoryName: "Loan Repayment",
							subtransactions: [
								{
									categoryName: "Category 13",
									subcategoryName: "Category 15",
									memo: "Sub transaction",
									rawAmount: 1,
									amount: "$1.00"
								},
								{
									categoryName: "Category 13",
									subcategoryName: "Category 15",
									memo: "Sub transaction",
									rawAmount: 1,
									amount: "$1.00"
								}
							],
							memo: "Loan Repayment",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "bank account 1",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							payeeName: "Payee 1",
							amount: 2,
							creditAmount: "~$2.00",
							categoryName: "Payslip",
							subtransactions: [
								{
									categoryName: "Category 1",
									subcategoryName: "Category 3",
									memo: "Sub transaction",
									rawAmount: 1,
									amount: "$1.00"
								},
								{
									categoryName: "Category 1",
									subcategoryName: "Category 3",
									memo: "Sub transaction",
									rawAmount: 1,
									amount: "$1.00"
								}
							],
							memo: "Payslip",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "investment account 5",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							securityName: "Security 1",
							categoryName: "Buy",
							accountName: "bank account 6",
							quantity: 2,
							price: 1,
							commission: 1,
							amount: 3,
							creditAmount: "~$3.00",
							memo: "",
							memoFromInvestmentDetails: "2 @ $1.00 (plus $1.00 commission)",
							type: "Security Buy (no memo)",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "investment account 5",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							securityName: "Security 1",
							categoryName: "Buy",
							accountName: "bank account 6",
							quantity: 2,
							price: 1,
							commission: 1,
							amount: 3,
							creditAmount: "~$3.00",
							memo: "Security Buy",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "investment account 5",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							securityName: "Security 1",
							categoryName: "Sell",
							accountName: "bank account 6",
							quantity: 2,
							price: 1,
							commission: 1,
							amount: 1,
							debitAmount: "~$1.00",
							memo: "Security Sell",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "investment account 5",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							securityName: "Security 1",
							quantity: 1,
							categoryName: "Add Shares",
							memo: "Security Add",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "investment account 5",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							securityName: "Security 1",
							quantity: 1,
							categoryName: "Remove Shares",
							memo: "Security Remove",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "investment account 5",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							securityName: "Security 1",
							quantity: 1,
							categoryName: "Transfer To",
							accountName: "investment account 7",
							memo: "Security Transfer",
							isEstimate: true,
							isAutoEntered: true
						},
						{
							primaryAccountName: "investment account 5",
							frequency: "Monthly",
							nextDueDate: tomorrow,
							securityName: "Security 1",
							amount: 1,
							debitAmount: "~$1.00",
							categoryName: "Dividend To",
							accountName: "bank account 6",
							memo: "Dividend",
							isEstimate: true,
							isAutoEntered: true
						}
					];

		beforeEach(() => {
			// Add a new schedule
			scheduleIndexView.addSchedule();
			waitForScheduleEditView("Add");
			targetRow = scheduleIndexView.table.lastRow();
			scrollIntoView(targetRow);
		});

		schedules.forEach(schedule => {
			describe(schedule.type || schedule.memo, () => {
				beforeEach(() => {
					expected = schedule;
					scheduleEditView.enterScheduleDetails(expected);
				});

				commonBehaviour();

				it("should insert a new schedule when the save button is clicked", () => {
					scheduleEditView.save();

					// Row count should have incremented by one
					scheduleIndexView.table.rows.count().should.eventually.equal(originalRowCount + 1);

					// Schedule in the target row should be the new schedule
					scheduleIndexView.checkRowValues(targetRow, expected);
				});
			});
		});
	});
Exemplo n.º 11
0
 var _loop_1 = function (i) {
     var date = dateFns.addDays(start, i);
     if (!excluded.some(function (e) { return date.getDay() === e; })) {
         days.push(getWeekDay({ date: date }));
     }
 };