本文整理汇总了TypeScript中@angular/common.DatePipe.transform方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DatePipe.transform方法的具体用法?TypeScript DatePipe.transform怎么用?TypeScript DatePipe.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common.DatePipe
的用法示例。
在下文中一共展示了DatePipe.transform方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resolve
.subscribe((domainResponse: HttpResponse<DomainAssess>) => {
const domain: DomainAssess = domainResponse.body;
domain.createdDate = this.datePipe
.transform(domain.createdDate, 'yyyy-MM-ddTHH:mm:ss');
domain.modifiedDate = this.datePipe
.transform(domain.modifiedDate, 'yyyy-MM-ddTHH:mm:ss');
this.ngbModalRef = this.domainModalRef(component, domain);
resolve(this.ngbModalRef);
});
示例2: resolve
.subscribe((controlCategoryResponse: HttpResponse<ControlCategoryAssess>) => {
const controlCategory: ControlCategoryAssess = controlCategoryResponse.body;
controlCategory.createdDate = this.datePipe
.transform(controlCategory.createdDate, 'yyyy-MM-ddTHH:mm:ss');
controlCategory.modifiedDate = this.datePipe
.transform(controlCategory.modifiedDate, 'yyyy-MM-ddTHH:mm:ss');
this.ngbModalRef = this.controlCategoryModalRef(component, controlCategory);
resolve(this.ngbModalRef);
});
示例3: resolve
.subscribe((attachmentResponse: HttpResponse<AttachmentAssess>) => {
const attachment: AttachmentAssess = attachmentResponse.body;
attachment.createdDate = this.datePipe
.transform(attachment.createdDate, 'yyyy-MM-ddTHH:mm:ss');
attachment.modifiedDate = this.datePipe
.transform(attachment.modifiedDate, 'yyyy-MM-ddTHH:mm:ss');
this.ngbModalRef = this.attachmentModalRef(component, attachment);
resolve(this.ngbModalRef);
});
示例4: resolve
.subscribe((complianceFlagResponse: HttpResponse<ComplianceFlagAssess>) => {
const complianceFlag: ComplianceFlagAssess = complianceFlagResponse.body;
complianceFlag.createdDate = this.datePipe
.transform(complianceFlag.createdDate, 'yyyy-MM-ddTHH:mm:ss');
complianceFlag.modifiedDate = this.datePipe
.transform(complianceFlag.modifiedDate, 'yyyy-MM-ddTHH:mm:ss');
this.ngbModalRef = this.complianceFlagModalRef(component, complianceFlag);
resolve(this.ngbModalRef);
});
示例5: resolve
.subscribe((principlesResponse: HttpResponse<PrinciplesAssess>) => {
const principles: PrinciplesAssess = principlesResponse.body;
principles.createdDate = this.datePipe
.transform(principles.createdDate, 'yyyy-MM-ddTHH:mm:ss');
principles.modifiedDate = this.datePipe
.transform(principles.modifiedDate, 'yyyy-MM-ddTHH:mm:ss');
this.ngbModalRef = this.principlesModalRef(component, principles);
resolve(this.ngbModalRef);
});
示例6: transform
transform(value: any): any {
if (value === null || value === '') {
return '';
}
return (
this.datePipe.transform(value, 'shortDate') +
' ' +
this.datePipe.transform(value, 'mediumTime')
);
}
示例7: resolve
this.reservationService.find(id).subscribe((reservation) => {
reservation.date_Revservation = this.datePipe
.transform(reservation.date_Revservation, 'yyyy-MM-ddThh:mm');
reservation.date_debut = this.datePipe
.transform(reservation.date_debut, 'yyyy-MM-ddThh:mm');
reservation.date_fin = this.datePipe
.transform(reservation.date_fin, 'yyyy-MM-ddThh:mm');
this.ngbModalRef = this.reservationModalRef(component, reservation);
resolve(this.ngbModalRef);
});
示例8: eventDates
eventDates(start, end): string {
// Display single-day events as "Jan 7, 2018"
// Display multi-day events as "Aug 12, 2017 - Aug 13, 2017"
const startDate = this.datePipe.transform(start, 'mediumDate');
const endDate = this.datePipe.transform(end, 'mediumDate');
if (startDate === endDate) {
return startDate;
} else {
return `${startDate} - ${endDate}`;
}
}
示例9: it
it('should format with pattern aliases', () => {
expect(pipe.transform(date, 'medium')).toEqual('Jun 15, 2015, 9:03:01 PM');
expect(pipe.transform(date, 'short')).toEqual('6/15/2015, 9:03 PM');
expect(pipe.transform(date, 'dd/MM/yyyy')).toEqual('15/06/2015');
expect(pipe.transform(date, 'MM/dd/yyyy')).toEqual('06/15/2015');
expect(pipe.transform(date, 'fullDate')).toEqual('Monday, June 15, 2015');
expect(pipe.transform(date, 'longDate')).toEqual('June 15, 2015');
expect(pipe.transform(date, 'mediumDate')).toEqual('Jun 15, 2015');
expect(pipe.transform(date, 'shortDate')).toEqual('6/15/2015');
expect(pipe.transform(date, 'mediumTime')).toEqual('9:03:01 PM');
expect(pipe.transform(date, 'shortTime')).toEqual('9:03 PM');
});
示例10: resolve
.subscribe((assessmentScheduleResponse: HttpResponse<AssessmentScheduleAssess>) => {
const assessmentSchedule: AssessmentScheduleAssess = assessmentScheduleResponse.body;
assessmentSchedule.fromDate = this.datePipe
.transform(assessmentSchedule.fromDate, 'yyyy-MM-ddTHH:mm:ss');
assessmentSchedule.toDate = this.datePipe
.transform(assessmentSchedule.toDate, 'yyyy-MM-ddTHH:mm:ss');
assessmentSchedule.createdDate = this.datePipe
.transform(assessmentSchedule.createdDate, 'yyyy-MM-ddTHH:mm:ss');
assessmentSchedule.modifiedDate = this.datePipe
.transform(assessmentSchedule.modifiedDate, 'yyyy-MM-ddTHH:mm:ss');
this.ngbModalRef = this.assessmentScheduleModalRef(component, assessmentSchedule);
resolve(this.ngbModalRef);
});