本文整理汇总了TypeScript中luxon.DateTime.fromISO方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DateTime.fromISO方法的具体用法?TypeScript DateTime.fromISO怎么用?TypeScript DateTime.fromISO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类luxon.DateTime
的用法示例。
在下文中一共展示了DateTime.fromISO方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should parse the JSON into a JobExecution model with step execution', () => {
const jobExecution = JobExecution.fromJSON(JOBS_EXECUTIONS_1);
expect(jobExecution.name).toBe('job1');
expect(jobExecution.startTime.toISO()).toBe(DateTime.fromISO('2017-08-11T06:15:50.027Z').toISO());
expect(jobExecution.endTime.toISO()).toBe(DateTime.fromISO('2017-08-11T06:15:50.067Z').toISO());
expect(jobExecution.stepExecutionCount).toBe(1);
expect(jobExecution.status).toBe('COMPLETED');
expect(jobExecution.exitCode).toBe('COMPLETED');
expect(jobExecution.exitMessage).toBe('');
expect(jobExecution.jobExecutionId).toBe(1);
expect(jobExecution.taskExecutionId).toBe(2);
expect(jobExecution.jobInstanceId).toBe(1);
expect(jobExecution.jobParametersString).toBe('--spring.cloud.task.executionid=2');
expect(jobExecution.restartable).toBe(false);
expect(jobExecution.abandonable).toBe(false);
expect(jobExecution.stoppable).toBe(false);
expect(jobExecution.defined).toBe(true);
expect(jobExecution.stepExecutions[0].id.toString()).toBe('1');
expect(jobExecution.stepExecutions[0].name).toBe('job1step1');
expect(jobExecution.stepExecutions[0].readCount).toBe(0);
expect(jobExecution.stepExecutions[0].writeCount).toBe(0);
expect(jobExecution.stepExecutions[0].commitCount).toBe(1);
expect(jobExecution.stepExecutions[0].rollbackCount).toBe(0);
expect(jobExecution.stepExecutions[0].readSkipCount).toBe(0);
expect(jobExecution.stepExecutions[0].processSkipCount).toBe(0);
expect(jobExecution.stepExecutions[0].writeSkipCount).toBe(0);
expect(jobExecution.stepExecutions[0].filterCount).toBe(0);
expect(jobExecution.stepExecutions[0].skipCount).toBe(0);
expect(jobExecution.stepExecutions[0].startTime.toISO()).toBe(DateTime.fromISO('2017-08-11T06:15:50.046Z').toISO());
expect(jobExecution.stepExecutions[0].endTime.toISO()).toBe(DateTime.fromISO('2017-08-11T06:15:50.064Z').toISO());
expect(jobExecution.stepExecutions[0].status).toBe('COMPLETED');
});
示例2: fromJSON
static fromJSON(input): JobExecution {
const jobExecution: JobExecution = new JobExecution();
jobExecution.name = input.name;
jobExecution.startTime = DateTime.fromISO(input.jobExecution.startTime);
jobExecution.stepExecutionCount = input.stepExecutionCount;
jobExecution.status = input.jobExecution.status;
jobExecution.jobExecutionId = input.jobExecution.id;
jobExecution.taskExecutionId = input.taskExecutionId;
jobExecution.jobInstanceId = input.jobExecution.jobInstance.id;
jobExecution.restartable = input.restartable;
jobExecution.abandonable = input.abandonable;
jobExecution.stoppable = input.stoppable;
jobExecution.defined = input.defined;
if (input.jobExecution.endTime) {
jobExecution.endTime = DateTime.fromISO(input.jobExecution.endTime);
}
if (input.jobExecution.exitStatus) {
jobExecution.exitCode = input.jobExecution.exitStatus.exitCode;
jobExecution.exitMessage = input.jobExecution.exitStatus.exitDescription;
}
jobExecution.jobParametersString = input.jobParametersString;
if (input.jobExecution.stepExecutions) {
jobExecution.stepExecutions = input.jobExecution.stepExecutions.map(StepExecution.fromJSON);
}
return jobExecution;
}
示例3: it
it('returns the date in the correct zone when given', () => {
const targetZone = 'America/New_York'
const currentLocalDate = DateTime.local(2000, 2, 6, 1, 0, 0)
setMockDate(currentLocalDate.toJSDate())
const d = DateTime.fromISO('20101005T110000').toJSDate()
const dt = new DateWithZone(d, targetZone)
expect(dt.rezonedDate()).to.deep.equal(
expectedDate(DateTime.fromISO('20101005T110000'), currentLocalDate, targetZone)
)
resetMockDate()
})
示例4: fromJSON
static fromJSON(jsonItem): TaskExecution {
return new TaskExecution(
jsonItem.executionId,
jsonItem.exitCode,
jsonItem.taskName,
jsonItem.startTime ? DateTime.fromISO(jsonItem.startTime) : null,
jsonItem.endTime ? DateTime.fromISO(jsonItem.endTime) : null,
jsonItem.exitMessage,
jsonItem.arguments,
jsonItem.jobExecutionIds,
jsonItem.errorMessage,
jsonItem.externalExecutionId);
}
示例5: convertDate
function convertDate(date: string | Date): DateTime {
if (typeof date === 'string') {
return DateTime.fromISO(date);
} else {
return DateTime.fromJSDate(date);
}
}
示例6: it
it('generates correcty zoned recurrences when a tzid is present', () => {
const targetZone = 'America/New_York'
const currentLocalDate = DateTime.local(2000, 2, 6, 11, 0, 0)
setMockDate(currentLocalDate.toJSDate())
const set = new RRuleSet()
set.rrule(new RRule({
freq: RRule.YEARLY,
count: 4,
dtstart: DateTime.fromISO('20000101T090000').toJSDate(),
tzid: targetZone
}))
set.exdate(
DateTime.fromISO('20010101T090000').toJSDate(),
)
set.rdate(
DateTime.fromISO('20020301T090000').toJSDate(),
)
expect(set.all()).to.deep.equal([
expectedDate(DateTime.fromISO('20000101T090000'), currentLocalDate, targetZone),
expectedDate(DateTime.fromISO('20020101T090000'), currentLocalDate, targetZone),
expectedDate(DateTime.fromISO('20020301T090000'), currentLocalDate, targetZone),
expectedDate(DateTime.fromISO('20030101T090000'), currentLocalDate, targetZone),
])
resetMockDate()
})
示例7: deserialize
/**
* For a given JSON data object, this method
* will populate the corresponding AuditRecord object, with
* the provided properties.
*
* @param input JSON input data
*/
public deserialize(input) {
this.auditRecordId = input.auditRecordId;
this.createdBy = input.createdBy;
this.correlationId = input.correlationId;
this.auditData = input.auditData;
this.createdOn = DateTime.fromISO(input.createdOn);
this.auditAction = input.auditAction;
this.auditOperation = input.auditOperation;
return this;
}
示例8: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [SituationComponent, TestComponent],
providers: [
{ provide: LOCALE_ID, useValue: 'fr-FR' }
]
});
jasmine.clock().mockDate(DateTime.fromISO('2018-05-01').toJSDate());
}));
示例9: beforeEach
beforeEach(() => {
jasmine.clock().mockDate(DateTime.fromISO('2017-08-02T15:30:00').toJSDate());
TestBed.configureTestingModule({
imports: [CurrentUserModule.forRoot(), HttpClientTestingModule]
});
service = TestBed.get(TaskService);
currentUserService = TestBed.get(CurrentUserService);
httpTester = new HttpTester(TestBed.get(HttpTestingController));
});