feat: localize share closing timezone

This commit is contained in:
Lukas Werner 2025-12-01 12:25:26 -08:00
parent 97bbafe827
commit ba346cdac7
No known key found for this signature in database

View File

@ -15,6 +15,15 @@ type File struct {
Key string
}
func isPhoto(filename string) bool {
switch path.Ext(filename) {
case ".jpg", ".jpeg", ".png", ".heic", ".webp", ".avif", ".gif", ".tiff":
return true
default:
return false
}
}
templ filetypeIcon(filename string) {
switch path.Ext(filename) {
case ".jpg",".jpeg", ".png",".heic", ".webp", ".avif", ".gif", ".tiff":
@ -52,7 +61,17 @@ templ ListShareContents(expires time.Time, shareid string, files []File) {
Class: "flex gap-2 items-center dark:text-white",
}) {
@icon.Timer()
{ expires.Format("03:04PM Jan 2") }
<span id="timeoutTime">Expires: { expires.Format("Jan 2, 03:04PM") }</span>
<script>
let expires = new Date({{ expires.Format(time.RFC1123Z) }});
timeoutTime.innerText = "Expires: " + expires.toLocaleString('en-US', {
hour: '2-digit',
minute: '2-digit',
hour12: true,
month: 'short',
day: 'numeric'
});
</script>
}
</div>
<a href={ "/download/" + shareid + "/zip" } id="download-link">
@ -97,8 +116,8 @@ templ ListShareContents(expires time.Time, shareid string, files []File) {
</div>
<script>
let checkedIds = [];
let downloadButton;
let downloadLink;
let downloadButton;
let downloadLink;
let downloadLinkZip;
let downloadIcon;
let share_id;