From 4eecbc1cfdf30c0d0d5f77c5608265bd4648ed78 Mon Sep 17 00:00:00 2001 From: "Daniel Nguyen (NAVWAR)" Date: Tue, 5 Sep 2023 15:37:28 -0700 Subject: [PATCH] Adding seconds to calendar widget --- .../timeline-card.component.html | 6 ++--- .../timeline-card/timeline-card.component.ts | 10 +++++++- .../trial-creator.component.html | 6 ++--- .../trial-creator/trial-creator.component.ts | 24 +++++++------------ 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/angular/app/src/app/shared/components/timeline/timeline-card/timeline-card.component.html b/angular/app/src/app/shared/components/timeline/timeline-card/timeline-card.component.html index 6c181b1..b7de9d8 100644 --- a/angular/app/src/app/shared/components/timeline/timeline-card/timeline-card.component.html +++ b/angular/app/src/app/shared/components/timeline/timeline-card/timeline-card.component.html @@ -80,10 +80,9 @@ [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1"> - - - End Datetime - diff --git a/angular/app/src/app/shared/components/trial/trial-creator/trial-creator.component.ts b/angular/app/src/app/shared/components/trial/trial-creator/trial-creator.component.ts index 793c951..25a6198 100644 --- a/angular/app/src/app/shared/components/trial/trial-creator/trial-creator.component.ts +++ b/angular/app/src/app/shared/components/trial/trial-creator/trial-creator.component.ts @@ -1,14 +1,23 @@ import { Component, OnInit, OnDestroy, Inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators , FormControl} from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { OWL_DATE_TIME_FORMATS} from 'ng-pick-datetime'; import { Trial, Campaign, ClockConfig } from '../../../models'; import { TrialApiService, AuthService, CampaignApiService } from '../../../services'; + +export const MY_NATIVE_FORMATS = { + fullPickerInput: {year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'}, +}; + @Component({ selector: 'mole-trial-creator', templateUrl: './trial-creator.component.html', styleUrls: ['./trial-creator.component.scss'], + providers: [ + { provide: OWL_DATE_TIME_FORMATS, useValue: MY_NATIVE_FORMATS }, +], }) export class TrialCreatorComponent implements OnInit { @@ -186,21 +195,6 @@ export class TrialCreatorComponent implements OnInit { public modifyTrialPayload() { - // set trial start and end time seconds to 0 - var trialStartDatetime = this.trialForm.get('start_datetime'); - if (trialStartDatetime) { - var startDate = new Date(trialStartDatetime.value); - startDate.setSeconds(0); - this.trialForm.get('start_datetime').setValue(startDate); - } - - var trialEndDatetime = this.trialForm.get('end_datetime'); - if (trialEndDatetime) { - var endDate = new Date(trialEndDatetime.value); - endDate.setSeconds(0); - this.trialForm.get('end_datetime').setValue(endDate); - } - var testersUrl = []; this.temp = this.trialForm.get('testers') this.temp = this.temp.value