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 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) { templ filetypeIcon(filename string) {
switch path.Ext(filename) { switch path.Ext(filename) {
case ".jpg",".jpeg", ".png",".heic", ".webp", ".avif", ".gif", ".tiff": 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", Class: "flex gap-2 items-center dark:text-white",
}) { }) {
@icon.Timer() @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> </div>
<a href={ "/download/" + shareid + "/zip" } id="download-link"> <a href={ "/download/" + shareid + "/zip" } id="download-link">
@ -97,8 +116,8 @@ templ ListShareContents(expires time.Time, shareid string, files []File) {
</div> </div>
<script> <script>
let checkedIds = []; let checkedIds = [];
let downloadButton; let downloadButton;
let downloadLink; let downloadLink;
let downloadLinkZip; let downloadLinkZip;
let downloadIcon; let downloadIcon;
let share_id; let share_id;