summaryrefslogtreecommitdiff
path: root/src/components/Datetime.tsx
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2025-09-24 09:12:44 +0200
committerYuval Adam <_@yuv.al>2025-09-24 09:12:44 +0200
commit4c5be8cf8d942743398581b46ac2c76d0ff273d8 (patch)
treeb182383a63302f24910c5534953d3624cb24f00d /src/components/Datetime.tsx
parent490214f0a9be03130cf535bc5ae0b8aa3c6c16db (diff)
Initial migration
Diffstat (limited to 'src/components/Datetime.tsx')
-rw-r--r--src/components/Datetime.tsx28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/components/Datetime.tsx b/src/components/Datetime.tsx
new file mode 100644
index 0000000..2010f8b
--- /dev/null
+++ b/src/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: LuxonDateTime | null = null;
+
+ if (images.length > 0 && images[slider]) {
+ 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>
+ );
+} \ No newline at end of file