diff options
| author | Yuval Adam <_@yuv.al> | 2024-09-23 10:10:19 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2024-09-23 10:10:19 +0200 |
| commit | af060f85a7bc13a5bb05e453c411f5807589e6c6 (patch) | |
| tree | 8527870ee8daaf3fa30bde7dd7090c647b706144 /geshem/app/components/Datetime.tsx | |
| parent | befc9ba3e4a9b24cdd0397663c04c98688d98d9b (diff) | |
Move most components into new path
Diffstat (limited to 'geshem/app/components/Datetime.tsx')
| -rw-r--r-- | geshem/app/components/Datetime.tsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/geshem/app/components/Datetime.tsx b/geshem/app/components/Datetime.tsx new file mode 100644 index 0000000..0a8fbcf --- /dev/null +++ b/geshem/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> + ); +} |
