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