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


TypeScript common.formatDate函數代碼示例

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


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

示例1: updateData

  updateData() {
    const time: Date = new Date(),
      formattedTime = formatDate(time, 'HH:mm:ss', 'en'),
      random = getRandomInt(1, 40),
      data = this.data.series[0],
      labels = this.data.labels;

    labels.push(formattedTime);
    data.push(random);

    // We only want to display 10 data points at a time
    this.data.labels = labels.slice(-9);
    this.data.series[0] = data.slice(-9);

    this.data = { ...this.data };
  }
開發者ID:paradox41,項目名稱:angular2-chartist,代碼行數:16,代碼來源:live-chart.component.ts

示例2: dayViewHour

 /**
  * The time formatting down the left hand side of the day view
  */
 public dayViewHour({ date, locale }: DateFormatterParams): string {
   return formatDate(date, 'h a', locale);
 }
開發者ID:mattlewis92,項目名稱:angular2-calendar,代碼行數:6,代碼來源:calendar-angular-date-formatter.provider.ts

示例3: dayViewTitle

 /**
  * The day view title
  */
 public dayViewTitle({ date, locale }: DateFormatterParams): string {
   return formatDate(date, 'EEEE, MMMM d, y', locale);
 }
開發者ID:mattlewis92,項目名稱:angular2-calendar,代碼行數:6,代碼來源:calendar-angular-date-formatter.provider.ts

示例4: formatDate

 const format = (dateToFormat: Date, showYear: boolean) =>
   formatDate(dateToFormat, 'MMM d' + (showYear ? ', yyyy' : ''), locale);
開發者ID:mattlewis92,項目名稱:angular2-calendar,代碼行數:2,代碼來源:calendar-angular-date-formatter.provider.ts

示例5: weekViewColumnSubHeader

 /**
  * The week view sub header day and month labels
  */
 public weekViewColumnSubHeader({
   date,
   locale
 }: DateFormatterParams): string {
   return formatDate(date, 'MMM d', locale);
 }
開發者ID:mattlewis92,項目名稱:angular2-calendar,代碼行數:9,代碼來源:calendar-angular-date-formatter.provider.ts

示例6: monthViewTitle

 /**
  * The month view title
  */
 public monthViewTitle({ date, locale }: DateFormatterParams): string {
   return formatDate(date, 'LLLL y', locale);
 }
開發者ID:mattlewis92,項目名稱:angular2-calendar,代碼行數:6,代碼來源:calendar-angular-date-formatter.provider.ts

示例7: monthViewDayNumber

 /**
  * The month view cell day number
  */
 public monthViewDayNumber({ date, locale }: DateFormatterParams): string {
   return formatDate(date, 'd', locale);
 }
開發者ID:mattlewis92,項目名稱:angular2-calendar,代碼行數:6,代碼來源:calendar-angular-date-formatter.provider.ts

示例8: monthViewColumnHeader

 /**
  * The month view header week day labels
  */
 public monthViewColumnHeader({ date, locale }: DateFormatterParams): string {
   return formatDate(date, 'EEEE', locale);
 }
開發者ID:mattlewis92,項目名稱:angular2-calendar,代碼行數:6,代碼來源:calendar-angular-date-formatter.provider.ts


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