From 945939cf9e1830e0bec0fe42a8b34f3e2eafa285 Mon Sep 17 00:00:00 2001 From: Nero Ignis Date: Sun, 16 Aug 2020 21:53:06 +0200 Subject: [PATCH] Adds answers for telling the time, day of the week and the date. --- .idea/workspace.xml | 21 ++++++++++++++------- app.js | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b2168c6..7e18621 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,9 +5,8 @@ - - + @@ -307,17 +313,18 @@ - - + - + diff --git a/app.js b/app.js index bfe31ce..316b099 100644 --- a/app.js +++ b/app.js @@ -215,6 +215,26 @@ let kara = new Vue({ return false; } + if ( + this.includesAllOf(phrases, ['whats', 'the', 'time']) || + this.includesAllOf(phrases, ['how', 'late']) + ) { + return "It's " + moment().format('LT'); + } + + if ( + this.includesAllOf(phrases, ['what', 'day', 'it']) + ) { + return "It's " + moment().format('dddd') + "."; + } + + if ( + this.includesAllOf(phrases, ['what', 'date', 'it']) || + this.includesAllOf(phrases, ['whats', 'the', 'date']) + ) { + return "It's " + moment().format('dddd') + ", " + moment().format('MMMM Do YYYY') + "."; + } + this.answers.forEach((answerOption) => { if (answerOption.includeAll === true) { if (