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


TypeScript esm.format函数代码示例

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


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

示例1: format

 format(date: NgbDateStruct): string {
     if (date === null) {
         return '';
     }
     const d = new Date(date.year, date.month - 1, date.day);
     return isValid(d) ? format(d, this.dateFormat) : '';
 }
开发者ID:wolfhoundjesse,项目名称:AMI,代码行数:7,代码来源:custom-ngbdate-parser-formatter.ts

示例2: stringify

	// Performs pre-processing before stringifying from JSON
	private stringify(schedule: ScheduledTransaction): ScheduledTransaction {
		// To avoid timezone issue, convert the native JS date back to a string ("YYYY-MM-DD") before saving
		const scheduleCopy = angular.copy(schedule);

		scheduleCopy.next_due_date = format(scheduleCopy.next_due_date, "YYYY-MM-DD");

		return scheduleCopy;
	}
开发者ID:scottohara,项目名称:loot,代码行数:9,代码来源:schedule.ts

示例3: parse

 parse(value: string): NgbDateStruct {
     if (!value) {
         return null;
     }
     const d = new Date(format(value, this.dateFormat));
     return isValid(d) ? { year: d.getFullYear(),
                            month: d.getMonth() + 1,
                            day: d.getDate() } : null;
 }
开发者ID:wolfhoundjesse,项目名称:AMI,代码行数:9,代码来源:custom-ngbdate-parser-formatter.ts

示例4: it

		it("should convert the next due date from a date to a string", (): void => {
			schedule.next_due_date.should.be.a("string");
			schedule.next_due_date.should.deep.equal(format(new Date(), "YYYY-MM-DD"));
		});
开发者ID:scottohara,项目名称:loot,代码行数:4,代码来源:schedule.ts

示例5: beforeEach

		beforeEach((): ScheduledTransaction => (schedule = scheduleModel["parse"](createScheduledBasicTransaction({next_due_date: format(new Date(), "YYYY-MM-DD HH:mm:ss")}))));
开发者ID:scottohara,项目名称:loot,代码行数:1,代码来源:schedule.ts

示例6: it

		it("should convert the transaction date from a date to a string", (): void => {
			(transaction.transaction_date as string).should.be.a("string");
			(transaction.transaction_date as string).should.deep.equal(format(new Date(), "YYYY-MM-DD"));
		});
开发者ID:scottohara,项目名称:loot,代码行数:4,代码来源:transaction.ts

示例7: beforeEach

		beforeEach((): Transaction => (transaction = transactionModel["parse"](createBasicTransaction({transaction_date: format(new Date(), "YYYY-MM-DD HH:mm:ss")}))));
开发者ID:scottohara,项目名称:loot,代码行数:1,代码来源:transaction.ts


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