default time for created days

This commit is contained in:
Tykayn 2021-05-18 12:45:51 +02:00 committed by tykayn
parent 3c4c0b5337
commit 0834ea3ffa
5 changed files with 19 additions and 14 deletions

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { DateChoice } from '../../../../mocks/old-stuff/config/defaultConfigs';
import { DateChoice, defaultTimeOfDay } from '../../../../mocks/old-stuff/config/defaultConfigs';
@Injectable({
providedIn: 'root',
@ -104,22 +104,22 @@ export class DateUtilitiesService {
return [
{
literal: this.formateDateToInputStringNg(ladate),
timeList: [],
timeList: defaultTimeOfDay,
date_object: ladate,
},
{
literal: this.formateDateToInputStringNg(ladate2),
timeList: [],
timeList: defaultTimeOfDay,
date_object: ladate2,
},
{
literal: this.formateDateToInputStringNg(ladate3),
timeList: [],
timeList: defaultTimeOfDay,
date_object: ladate3,
},
{
literal: this.formateDateToInputStringNg(ladate4),
timeList: [],
timeList: defaultTimeOfDay,
date_object: ladate4,
},
];

View File

@ -18,8 +18,8 @@
>
<i class="fa fa-check-square-o" *ngIf="form.value.hasSeveralHours"></i>
<i class="fa fa-square-o" *ngIf="!form.value.hasSeveralHours"></i>
<span> horaires avancées</span>
<i class="fa fa-clock-o"></i>
<span> horaires avancées</span>
</button>
<div class="is-info notification">
<span *ngIf="form.value.hasSeveralHours">

View File

@ -32,7 +32,9 @@
>
<span class="button is-default" for="dateChoices_{{ id }}">
<i class="icon fa fa-arrows-v"></i>
{{ choice.date_object | date: 'E':'Europe/Paris':'fr_FR' }}
<span *ngIf="choice.date_object">
{{ choice.date_object | date: 'E':'Europe/Paris':'fr_FR' }}
</span>
</span>
<input
[(ngModel)]="choice.date_object"

View File

@ -56,11 +56,11 @@ export class DayListComponent {
/**
* add a time period to a specific date choice,
* focus on the new input
* @param config
* @param id
* @param choice DateChoice
* @param id number
*/
addTimeToDate(config: any, id: number) {
this.timeList.push({
addTimeToDate(choice: DateChoice, id: number) {
choice.timeList.push({
literal: '',
});
const selector = '[ng-reflect-choice_label="dateTime_' + id + '_ dateList_' + (this.timeList.length - 1) + '"]';
@ -147,7 +147,10 @@ export class DayListComponent {
}
isWeekendDay(date_object: Date) {
const day = date_object.getDay();
return day === 6 || day === 0;
if (date_object) {
const day = date_object.getDay();
return day === 6 || day === 0;
}
return false;
}
}

View File

@ -105,7 +105,7 @@ export class FormComponent implements OnInit {
creatorEmail: '',
description: 'RSVP',
isAboutDate: true,
hasSeveralHours: false,
hasSeveralHours: true,
kind: 'date',
password: '',
whoCanChangeAnswers: 'everybody',