From 8a6ff5a2c15422badf0bc9c8166787dc23a71072 Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Mon, 23 Sep 2024 10:29:53 +0200
Subject: Move all geshem/ files to root

---
 app/components/Datetime.tsx | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 app/components/Datetime.tsx

(limited to 'app/components/Datetime.tsx')

diff --git a/app/components/Datetime.tsx b/app/components/Datetime.tsx
new file mode 100644
index 0000000..0a8fbcf
--- /dev/null
+++ b/app/components/Datetime.tsx
@@ -0,0 +1,28 @@
+import React from "react";
+import { DateTime as LuxonDateTime } from "luxon";
+
+interface DateTimeProps {
+  images: string[],
+  slider: number
+}
+
+export function DateTime({ images, slider }: DateTimeProps) {
+  let datetime = null;
+
+  if (images.length > 0) {
+    const ds = images[slider].substring(5, 18);
+    datetime = LuxonDateTime.fromFormat(ds, "yyyyMMdd/HHmm", {
+      zone: "utc",
+    }).setZone("Asia/Jerusalem");
+  }
+
+  const date = datetime ? datetime.toFormat("dd/MM/y") : "";
+  const time = datetime ? datetime.toFormat("HH:mm") : "";
+
+  return (
+    <div id="datetime">
+      <div id="date">{date}</div>
+      <div id="time">{time}</div>
+    </div>
+  );
+}
-- 
cgit v1.3.1

