From 78894016812638b4cfaaa2299f9ccd978dc2b27f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 12 Dec 2020 17:27:44 -0500 Subject: [PATCH] added a timestamp for every task that is created --- src/main/scala/model/Task.scala | 9 +++++++- todo-scheduler.iml | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 todo-scheduler.iml diff --git a/src/main/scala/model/Task.scala b/src/main/scala/model/Task.scala index f6da7b2..d77b3a6 100644 --- a/src/main/scala/model/Task.scala +++ b/src/main/scala/model/Task.scala @@ -1,5 +1,8 @@ package model +import java.text.SimpleDateFormat +import java.util.Calendar + import play.api.libs.json.{JsValue, Json} @@ -21,7 +24,11 @@ object Task { def apply(title: String, description: String): Task = { val thisId = nextId nextId += 1 - new Task(cleanString(title), cleanString(description, 1000), thisId.toString) + + val format = new SimpleDateFormat(" '[Created on' EEE, MMM dd 'at' hh:mm aa']'") + val dateCreated = format.format(Calendar.getInstance().getTime()) + + new Task(cleanString(title), cleanString(description, 1000) + dateCreated, thisId.toString) } diff --git a/todo-scheduler.iml b/todo-scheduler.iml new file mode 100644 index 0000000..8333d43 --- /dev/null +++ b/todo-scheduler.iml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file