Skip to content

Commit

Permalink
Merge branch 'update_calendar_widget' into 'main'
Browse files Browse the repository at this point in the history
Adding seconds to calendar widget

See merge request mole/mole!39
  • Loading branch information
Ryan Halterman (NAVWAR) committed Sep 5, 2023
2 parents 548b0fc + 4eecbc1 commit ff9eb33
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@
[owlDateTime]="dt1"
[owlDateTimeTrigger]="dt1">
<button mat-button [owlDateTimeTrigger]="dt1" matSuffix mat-icon-button aria-label="start_datetime">
<owl-date-time hour12Timer="true" #dt1></owl-date-time>
<owl-date-time hour12Timer="true" showSecondsTimer="true" #dt1></owl-date-time>
<mat-icon>calendar_today</mat-icon>
</button>
<owl-date-time #dt1></owl-date-time>
</mat-form-field>
<button mat-icon-button (click)="toggleEditStartDatetime()">
<mat-icon>done</mat-icon>
Expand Down Expand Up @@ -119,10 +118,9 @@
[owlDateTime]="dt2"
[owlDateTimeTrigger]="dt2">
<button mat-button [owlDateTimeTrigger]="dt2" matSuffix mat-icon-button aria-label="end_datetime">
<owl-date-time hour12Timer="true" #dt2></owl-date-time>
<owl-date-time hour12Timer="true" showSecondsTimer="true" #dt2></owl-date-time>
<mat-icon>calendar_today</mat-icon>
</button>
<owl-date-time #dt2></owl-date-time>
</mat-form-field>
<button id="button-mat-form-field-done" mat-icon-button (click)="toggleEditEndDatetime()">
<mat-icon>done</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
HostListener,
EventEmitter,
} from '@angular/core';
import { OWL_DATE_TIME_FORMATS} from 'ng-pick-datetime';
import { Event, EventType, EventImage, Pose } from '../../../models'
import { MatDialog } from '@angular/material/dialog';
import { EventDialogComponent } from '../../event/event-dialog/event-dialog.component';
Expand All @@ -27,10 +28,17 @@ const enum ResizeState {
RESIZE = 1
}

export const MY_NATIVE_FORMATS = {
fullPickerInput: {year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'},
};

@Component({
selector: 'mole-timeline-card',
templateUrl: './timeline-card.component.html',
styleUrls: ['./timeline-card.component.scss']
styleUrls: ['./timeline-card.component.scss'],
providers: [
{ provide: OWL_DATE_TIME_FORMATS, useValue: MY_NATIVE_FORMATS },
],
})
export class TimelineCardComponent implements OnInit, AfterViewInit {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@
<mat-label>Start Datetime</mat-label>
<input matInput formControlName="start_datetime" [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1" placeholder="yyyyy-MMM-ddTHH:mm:ss:">
<button mat-button [owlDateTimeTrigger]="dt1" matSuffix mat-icon-button aria-label="start_datetime">
<owl-date-time color="primary" hour12Timer="true" #dt1></owl-date-time>
<owl-date-time color="primary" hour12Timer="true" showSecondsTimer="true" #dt1></owl-date-time>
<mat-icon>calendar_today</mat-icon>
</button>
<owl-date-time #dt1></owl-date-time>
</mat-form-field>

<mat-form-field appearance="fill" class="form-element-md ml-2">
<mat-label>End Datetime</mat-label>
<input matInput formControlName="end_datetime" [owlDateTime]="dt2" [owlDateTimeTrigger]="dt2" placeholder="yyyyy-MMM-ddTHH:mm:ss:">
<button mat-button [owlDateTimeTrigger]="dt2" matSuffix mat-icon-button aria-label="end_datetime">
<owl-date-time color="primary" hour12Timer="true" #dt2></owl-date-time>
<owl-date-time color="primary" hour12Timer="true" showSecondsTimer="true" #dt2></owl-date-time>
<mat-icon>calendar_today</mat-icon>
</button>
<owl-date-time #dt2></owl-date-time>

</mat-form-field>

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff9eb33

Please sign in to comment.