forked from tykayn/funky-framadate-front
date accessor
This commit is contained in:
parent
460e236d60
commit
22736f709e
@ -7,6 +7,7 @@ import {defaultAnswers} from "./defaultConfigs";
|
||||
export interface DateOption {
|
||||
timeList: any;
|
||||
literal: string;
|
||||
date_object?: object;
|
||||
}
|
||||
|
||||
const baseConfigValues = {
|
||||
|
@ -8,14 +8,17 @@ export const timeOfDay = [{
|
||||
export const defaultDates = [
|
||||
{
|
||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`,
|
||||
date_object: new Date(),
|
||||
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
||||
},
|
||||
{
|
||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`,
|
||||
date_object: new Date(),
|
||||
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
||||
},
|
||||
{
|
||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`,
|
||||
date_object: new Date(),
|
||||
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
||||
}
|
||||
];
|
||||
@ -24,6 +27,7 @@ export const defaultAnswers = [{
|
||||
text: 'réponse de démo 1',
|
||||
url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574',
|
||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`,
|
||||
date_object: new Date(),
|
||||
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
||||
},
|
||||
{
|
||||
@ -31,10 +35,12 @@ export const defaultAnswers = [{
|
||||
text: 'réponse 2',
|
||||
url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574',
|
||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`,
|
||||
date_object: new Date(),
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: 'la réponse D',
|
||||
url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574',
|
||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`,
|
||||
date_object: new Date(),
|
||||
}];
|
||||
|
@ -154,7 +154,7 @@
|
||||
class="date-choice"
|
||||
>
|
||||
<input
|
||||
[(ngModel)]="choice.literal"
|
||||
[(ngModel)]="choice.date_object"
|
||||
name="dateChoices_{{id}}"
|
||||
id="dateChoices_{{id}}"
|
||||
useValueAsDate
|
||||
@ -181,7 +181,7 @@
|
||||
class="time-choice"
|
||||
>
|
||||
<input
|
||||
[(ngModel)]="time.literal"
|
||||
[(ngModel)]="time.date_object"
|
||||
name="dateTime_{{id}}_Choices_{{idTime}}"
|
||||
id="dateTime_{{id}}_Choices_{{idTime}}"
|
||||
useValueAsDate
|
||||
|
@ -43,7 +43,10 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
||||
}
|
||||
|
||||
addDate() {
|
||||
this.config.dateList.push({literal: '', timeList: []});
|
||||
this.config.dateList.push({
|
||||
literal: '',
|
||||
date_object: new Date(),
|
||||
timeList: []});
|
||||
let selector = '[ng-reflect-name="dateChoices_' + (this.config.dateList.length - 1) + '"]';
|
||||
this.cd.detectChanges();
|
||||
const elem = this.document.querySelector(selector);
|
||||
|
Loading…
Reference in New Issue
Block a user