aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2021-01-31 18:46:34 -0500
committerGalen Guyer <galen@galenguyer.com>2021-01-31 18:46:34 -0500
commitae53046ebb782b89919dc08d17fce7ad829a75c1 (patch)
tree3f2cfaa8f31ee9d056ebd4fb6536037325f0d28b
parenta9a75bc2d0c6fa96cefa9ca0c4896082ad8e68dc (diff)
Add two weeks ago option and show time diff
-rw-r--r--src/App.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/App.js b/src/App.js
index 6dd6d83..c4dfc7d 100644
--- a/src/App.js
+++ b/src/App.js
@@ -97,13 +97,14 @@ function App() {
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
- })}
+ })}{" "}
+ ({timeDifference == 1 ? "one day ago" : timeDifference == 5 ? "one week ago" : "two weeks ago"})
</h4>
<button
- onClick={() => setTimeDifference(timeDifference == 1 ? 5 : 1)}
+ onClick={() => setTimeDifference(timeDifference == 1 ? 5 : timeDifference == 5 ? 10 : 1)}
className="bg-transparent text-sm hover:bg-orange-400 text-gray-600 hover:text-white py-1 my-1 px-2 border border-orange-300 hover:border-transparent rounded transition ease-in-out duration-300"
>
- Use one {timeDifference == 1 ? "week" : "day"} ago
+ Use {timeDifference == 10 ? "one day" : timeDifference == 5 ? "two weeks" : "one week"} ago
</button>
&nbsp;
<button