fix(postgres): render temporal values in session timezone
This commit is contained in:
1 parent
a33768ef6e
commit
ba77d94815
7 files changed
+329
-40
No files matched your search
@@ -4,7 +4,7 @@ import type { FocusOutsideEvent, PointerDownOutsideEvent } from "reka-ui";
|
||||
import { CalendarClock, ChevronDown, ChevronUp, CircleSlash } from "@lucide/vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { formatTemporalInputValue, parseTemporalInputValue, stepTemporalInputValue, type TemporalCellEditorKind } from "@/lib/dataGrid/dataGridTemporalEditor";
|
||||
import { formatTemporalInputValue, parseTemporalInputValue, stepTemporalInputValue, temporalOffsetSuffix, type TemporalCellEditorKind } from "@/lib/dataGrid/dataGridTemporalEditor";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -134,7 +134,7 @@ function updateTime(part: "hour" | "minute" | "second", rawValue: string | numbe
|
||||
const parts = { ...timeParts.value, [part]: normalizeTimePart(rawValue, part === "hour" ? 23 : 59) };
|
||||
const nextTime = `${parts.hour}:${parts.minute}:${parts.second}${fractionSuffix.value}`;
|
||||
if (props.kind === "time") {
|
||||
setModelValue(nextTime, true);
|
||||
setModelValue(`${nextTime}${temporalOffsetSuffix(localValue.value, props.kind)}`, true);
|
||||
return;
|
||||
}
|
||||
setDateTimeValue(dateParts.value.year, dateParts.value.month, dateParts.value.day, nextTime);
|
||||
@@ -162,7 +162,7 @@ function updateFractionValue(rawValue: string) {
|
||||
const digits = rawValue.replace(/\D/g, "").slice(0, maxLength);
|
||||
const nextTime = `${timeParts.value.hour}:${timeParts.value.minute}:${timeParts.value.second}${digits ? `.${digits}` : ""}`;
|
||||
if (props.kind === "time") {
|
||||
setModelValue(nextTime, true);
|
||||
setModelValue(`${nextTime}${temporalOffsetSuffix(localValue.value, props.kind)}`, true);
|
||||
return;
|
||||
}
|
||||
setDateTimeValue(dateParts.value.year, dateParts.value.month, dateParts.value.day, nextTime);
|
||||
@@ -267,7 +267,7 @@ function normalizeTimePart(value: string | number, max: number): string {
|
||||
function setDateTimeValue(year: number, month: number, day: number, time: string) {
|
||||
const dateText = [String(year).padStart(4, "0"), String(month).padStart(2, "0"), String(day).padStart(2, "0")].join("-");
|
||||
if (props.kind === "date") setModelValue(dateText, true);
|
||||
else setModelValue(`${dateText} ${time}`, true);
|
||||
else setModelValue(`${dateText} ${time}${temporalOffsetSuffix(localValue.value, props.kind)}`, true);
|
||||
}
|
||||
|
||||
function parseFractionDigits(value: string): string {
|
||||
|
||||
Reference in new issue
Block a user