mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-20 03:13:31 +01:00
show local date on hover
This commit is contained in:
1 parent
5d87385170
commit
8416f03bcf
38 files changed
+144
-105
No files matched your search
@@ -1,13 +1,24 @@
|
||||
<script>
|
||||
import tooltip from "@/actions/tooltip";
|
||||
import CommonHelper from "@/utils/CommonHelper";
|
||||
|
||||
export let date = "";
|
||||
|
||||
$: dateOnly = date ? date.substring(0, 10) : null;
|
||||
|
||||
$: timeOnly = date ? date.substring(10, 19) : null;
|
||||
|
||||
const tooltipData = {
|
||||
// generate the tooltip text as getter to speed up the initial load
|
||||
// in case the component is used with large number of items
|
||||
get text() {
|
||||
return CommonHelper.formatToLocalDate(date) + " Local";
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if date}
|
||||
<div class="datetime">
|
||||
<div class="datetime" use:tooltip={tooltipData}>
|
||||
<div class="date">{dateOnly}</div>
|
||||
<div class="time">{timeOnly} UTC</div>
|
||||
</div>
|
||||
@@ -17,8 +28,9 @@
|
||||
|
||||
<style>
|
||||
.datetime {
|
||||
width: 100%;
|
||||
display: block;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
line-height: var(--smLineHeight);
|
||||
}
|
||||
.time {
|
||||
|
||||
Reference in new issue
Block a user