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


TypeScript DateTime.fromISO方法代碼示例

本文整理匯總了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');
 });
開發者ID:BoykoAlex,項目名稱:spring-cloud-dataflow-ui,代碼行數:32,代碼來源:job-execution.model.spec.ts

示例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;
 }
開發者ID:BoykoAlex,項目名稱:spring-cloud-dataflow-ui,代碼行數:26,代碼來源:job-execution.model.ts

示例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()
  })
開發者ID:jkbrzt,項目名稱:rrule,代碼行數:13,代碼來源:datewithzone.test.ts

示例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);
 }
開發者ID:BoykoAlex,項目名稱:spring-cloud-dataflow-ui,代碼行數:13,代碼來源:task-execution.ts

示例5: convertDate

function convertDate(date: string | Date): DateTime {
  if (typeof date === 'string') {
    return DateTime.fromISO(date);
  } else {
    return DateTime.fromJSDate(date);
  }
}
開發者ID:ha4us,項目名稱:ha4us.old,代碼行數:7,代碼來源:templates.ts

示例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()
    })
開發者ID:jkbrzt,項目名稱:rrule,代碼行數:31,代碼來源:rruleset.test.ts

示例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;
 }
開發者ID:BoykoAlex,項目名稱:spring-cloud-dataflow-ui,代碼行數:17,代碼來源:audit-record.model.ts

示例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());
  }));
開發者ID:Ninja-Squad,項目名稱:globe42,代碼行數:10,代碼來源:situation.component.spec.ts

示例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));
  });
開發者ID:Ninja-Squad,項目名稱:globe42,代碼行數:11,代碼來源:task.service.spec.ts


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