当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript d3-time-format.timeFormat函数代码示例

本文整理汇总了TypeScript中d3-time-format.timeFormat函数的典型用法代码示例。如果您正苦于以下问题:TypeScript timeFormat函数的具体用法?TypeScript timeFormat怎么用?TypeScript timeFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了timeFormat函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: buildNotification

function buildNotification(trade, error) {
  if (error) {
    return { message: error, hasError: true, notificationType: NotificationType.Text }
  }

  return {
    notificationType: NotificationType.Trade,
    hasError: false,
    direction: trade.direction === Direction.Sell ? 'Sold' : 'Bought',
    notional: numeral(trade.notional).format('0,000,000[.]00'),
    status: trade.status,
    dealtCurrency: trade.currencyPair.base,
    termsCurrency: trade.currencyPair.terms,
    spotRate: trade.spotRate,
    formattedValueDate: `SP. ${timeFormat('%b %e')(trade.valueDate)}`,
    tradeId: trade.tradeId,
  }
}
开发者ID:tdeheurles,项目名称:ReactiveTraderCloud,代码行数:18,代码来源:spotTileOperations.ts

示例2: Date

let formatFn: (n: Date) => string;

let parseFn: (dateString: string) => (Date | null);

let localeDef: d3TimeFormat.TimeLocaleDefinition;

let localeObj: d3TimeFormat.TimeLocaleObject;

// ----------------------------------------------------------------------
// Test Formating and Parsing
// ----------------------------------------------------------------------

// local time -----------------------------------------------------------

formatFn = d3TimeFormat.timeFormat('.%L');
parseFn = d3TimeFormat.timeParse('.%L');

// utc ------------------------------------------------------------------

formatFn = d3TimeFormat.utcFormat('.%L');
parseFn = d3TimeFormat.utcParse('.%L');

// iso ------------------------------------------------------------------

const dateString: string = d3TimeFormat.isoFormat(new Date(2016, 6, 6));
const date: Date | null = d3TimeFormat.isoParse('2016-07-08T14:06:41.386Z');

// ----------------------------------------------------------------------
// Test Locale Definition
// ----------------------------------------------------------------------
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-time-format-tests.ts

示例3: constructor

 constructor(id: string, desc: Readonly<IDateMapColumnDesc>) {
   super(id, desc);
   this.format = timeFormat(desc.dateFormat || '%x');
   this.parse = desc.dateParse ? timeParse(desc.dateParse) : timeParse(desc.dateFormat || '%x');
   this.setDefaultRenderer('default');
 }
开发者ID:Caleydo,项目名称:lineup.js,代码行数:6,代码来源:DatesMapColumn.ts

示例4: timeFormat

/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */

import { timeFormat } from 'd3-time-format';

const formatDate = timeFormat('%Y-%m-%d %H:%M:%S.%L');

export function formatTime(time: number) {
  return formatDate(new Date(time));
}
开发者ID:gingerwizard,项目名称:kibana,代码行数:13,代码来源:time.ts

示例5: formatDate

export function formatDate(date: any, format:string = '%b %e, %H:%M:%S') {
  return timeFormat(format)(date)
}
开发者ID:carlosrfernandez,项目名称:ReactiveTraderCloud,代码行数:3,代码来源:utils.ts


注:本文中的d3-time-format.timeFormat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。