From 22736f709e36463e9e470e9a3385d246c85fd85f Mon Sep 17 00:00:00 2001 From: Baptiste Lemoine Date: Fri, 24 Jan 2020 11:15:38 +0100 Subject: [PATCH] date accessor --- src/app/config/PollConfig.ts | 1 + src/app/config/defaultConfigs.ts | 6 ++++++ src/app/pages/dates/dates.component.html | 4 ++-- src/app/pages/dates/dates.component.ts | 5 ++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts index a0534918..5d482934 100644 --- a/src/app/config/PollConfig.ts +++ b/src/app/config/PollConfig.ts @@ -7,6 +7,7 @@ import {defaultAnswers} from "./defaultConfigs"; export interface DateOption { timeList: any; literal: string; + date_object?: object; } const baseConfigValues = { diff --git a/src/app/config/defaultConfigs.ts b/src/app/config/defaultConfigs.ts index 1320521f..7b899dc6 100644 --- a/src/app/config/defaultConfigs.ts +++ b/src/app/config/defaultConfigs.ts @@ -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(), }]; diff --git a/src/app/pages/dates/dates.component.html b/src/app/pages/dates/dates.component.html index 0fbddcbe..decf46e0 100644 --- a/src/app/pages/dates/dates.component.html +++ b/src/app/pages/dates/dates.component.html @@ -154,7 +154,7 @@ class="date-choice" >