當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript moment-timezone.default函數代碼示例

本文整理匯總了TypeScript中moment-timezone.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了default函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getDate

  protected getDate(date: any, defaultValue: any = null) {
    if (!date) {
      return defaultValue;
    }

    return moment(date)
      .tz(this.timezone)
      .format(DATE_FORMAT);
  }
開發者ID:easygenerator,項目名稱:lrs,代碼行數:9,代碼來源:DataMapper.ts

示例2: diffWithCurrentTime

    function diffWithCurrentTime(team: Team) {
        let currentTime = moment();

        let endTime = moment(team.endQuestDate);


        return endTime.diff(currentTime, 'seconds');
    }
開發者ID:anstarovoyt,項目名稱:dmmquest,代碼行數:8,代碼來源:server.ts

示例3: it

 it('understands cron intervals with a timezone when last run is the same as the interval', () => {
     job.attrs.lastRunAt = new Date('2015-01-01T06:00:00-00:00');
     job.repeatEvery('0 6 * * *', {
         timezone: 'GMT'
     });
     job.computeNextRunAt();
     expect(moment(job.attrs.nextRunAt).tz('GMT').hour()).to.be(6);
     expect(moment(job.attrs.nextRunAt).toDate().getDate()).to.be(moment(job.attrs.lastRunAt).add(1, 'days').toDate().getDate());
 });
開發者ID:cdbajorin,項目名稱:typed-agenda,代碼行數:9,代碼來源:agenda.ts

示例4: downloadEarnings

  public async downloadEarnings(): Promise<void> {
    const date: Date = moment().tz("America/New_York").toDate();
    const dateStr: string = moment().tz("America/New_York").format("YYYY-MM-DD");
    const dateThreshold: Date = moment().add(5, "days").tz("America/New_York").toDate();
    const currentSeason = await this.sql.getSelectedSeason(undefined);
    if (currentSeason === undefined || currentSeason.getEndDate() < date) {
      return;
    }

    const moviesToGet = Enumerable.from(currentSeason.movies)
      .where((m) => m.releaseDate <= dateThreshold)
      .orderByDescending((m) => m.releaseDate)
      .toArray();

    let earnings: Earning[] = [];
    for (const url of currentSeason.urls) {
      const html = await this.http.download(url.url, {});
      const rows = MojoParser.parse(html);
      const earningsToAdd = MojoParser.getEarnings(rows, moviesToGet);
      earnings = earnings.concat(earningsToAdd);
    }

    for (const earning of earnings) {
      const value = accounting.formatMoney(earning.gross, "$", 0);
      this.output.write(`${earning.movie.name}: ${value}\n`);
    }

    await this.sql.deleteEarningsForDate(dateStr);
    const addPromise = this.sql.addEarningsForMovies(earnings);

    this.output.write("\n");

    const ratingsPromises: Array<Promise<void>> = [];
    for (const movie of moviesToGet) {
      if (movie.metacriticUrl === undefined) {
        continue;
      }
      const rating = await this.getRating(movie.metacriticUrl, 0);
      if (rating === undefined) {
        continue;
      }
      ratingsPromises.push(this.sql.updateRatingForMovie(movie, rating));
      this.output.write(`${movie.name}: ${rating}%\n`);
    }

    await addPromise;
    await Promise.all(ratingsPromises);
  }
開發者ID:snickroger,項目名稱:FantasyMovieLeague,代碼行數:48,代碼來源:earningsDownloader.ts

示例5: parse

 parse(value: string): NgbDateStruct {
   const inst: any = moment(value, DATE_FORMAT);
   return {
     year: inst.year(),
     month: inst.month() + 1, // moment return 0-11 for month
     day: inst.date(),
   };
 }
開發者ID:TEAMMATES,項目名稱:teammates,代碼行數:8,代碼來源:session-edit-form-datepicker-formatter.ts

示例6: endDateBeforeRender

    endDateBeforeRender($view, $dates): void {
        if (this.editor.StartDate) {
            const activeDate: moment.Moment = moment(this.editor.StartDate).subtract(1, $view).add(1, "minute");

            $dates.filter(date => date.localDateValue() <= activeDate.valueOf())
                .forEach(date => date.selectable = false);
        }
    }
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:8,代碼來源:datetime-form.class.ts

示例7: startDateBeforeRender

    startDateBeforeRender($dates): void {
        if (this.editor.EndDate) {
            const activeDate: moment.Moment = moment(this.editor.EndDate);

            $dates.filter(date => date.localDateValue() >= activeDate.valueOf())
                .forEach(date => date.selectable = false);
        }
    }
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:8,代碼來源:datetime-form.class.ts

示例8: format

  format(date: NgbDateStruct): string {
    if (date == null) {
      return '';
    }

    const inst: any = moment();
    inst.set('year', date.year);
    inst.set('month', date.month - 1); // moment month is from 0-11
    inst.set('date', date.day);

    return inst.format(DATE_FORMAT);
  }
開發者ID:TEAMMATES,項目名稱:teammates,代碼行數:12,代碼來源:session-edit-form-datepicker-formatter.ts

示例9: moment

	export const upsertDevice = (memberid: string, device: string): Promise<any> =>

		DeviceTrackingModel.findOneAndUpdate(
			{
				memberid: memberid,
				device: device
			},
			{
				$set: {
					memberid: memberid,
					device: device,
					lastUsed: moment()
				}
			},
			UPSERT_OPTIONS);
開發者ID:roderickmonk,項目名稱:rod-monk-sample-repo-ng2,代碼行數:15,代碼來源:DB.ts

示例10: it

    it("#formattedDate", () => {
        const dateTimeFormClass: DatetimeFormClass = new DatetimeFormClass($scope);
        const dateTime: moment.Moment = moment("2018-12-03");

        expect(dateTimeFormClass.formattedDate(dateTime)).toEqual("3 December 2018");
    });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:6,代碼來源:datetime-form.class.spec.ts


注:本文中的moment-timezone.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。