Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(grid): add 12-hour datetime format and timezone aliases

二丫讲梵349342efb795
diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue
index 3d3eac0ade..43cb8263e1 100644
--- a/apps/desktop/src/components/grid/DataGrid.vue
+++ b/apps/desktop/src/components/grid/DataGrid.vue
@@ -174,6 +174,8 @@ import {
applyColumnFormatter,
buildColumnFormatterKey,
defaultIoTDBTimestampFormatter,
+ DataGridDateTimePatterns,
+ displayTimeZoneOption,
formatIoTDBTimestampEditorValue,
getSupportedTimeZoneOptions,
iotdbTimestampFractionDigits,
@@ -184,7 +186,6 @@ import {
type ColumnFormatterConfig,
type DateTimeFormatterUnit,
type ForeignKeyDisplayFilterConfig,
- DateTimePatterns,
} from "@/lib/dataGrid/columnFormatter";
import { temporalCellEditorConfig, type TemporalCellEditorConfig } from "@/lib/dataGrid/dataGridTemporalEditor";
import { BOOLEAN_CELL_EDITOR_VALUES, booleanCellEditorValue, isBooleanCellValue, isBooleanColumnType, isPointInBooleanCheckbox, nextBooleanCellValue, normalizeBooleanCellValue, parseBooleanCellEditorValue } from "@/lib/dataGrid/dataGridBooleanColumn";
@@ -12983,7 +12984,7 @@ function openGridSnapshot() {
</div>
<SearchableSelect
:model-value="formatterDatetimePattern"
- :options="DateTimePatterns"
+ :options="DataGridDateTimePatterns"
:placeholder="t('grid.formatterDatetimePatternPlaceholder')"
:search-placeholder="t('grid.formatterDatetimePatternPlaceholder')"
:empty-text="t('grid.formatterDatetimePatternEmpty')"
@@ -13002,6 +13003,7 @@ function openGridSnapshot() {
<SearchableSelect
:model-value="formatterDateTimezone"
:options="timezoneOptions"
+ :display-name="displayTimeZoneOption"
:placeholder="t('grid.formatterDatetimeTimezonePlaceholder')"
:search-placeholder="t('grid.formatterDatetimeTimezonePlaceholder')"
:empty-text="t('grid.formatterDatetimeTimezonePlaceholder')"
diff --git a/apps/desktop/src/lib/dataGrid/columnFormatter.ts b/apps/desktop/src/lib/dataGrid/columnFormatter.ts
index a8aa7330af..b53630f021 100644
--- a/apps/desktop/src/lib/dataGrid/columnFormatter.ts
+++ b/apps/desktop/src/lib/dataGrid/columnFormatter.ts
@@ -28,6 +28,9 @@ export const DateTimePatterns = [
"YYYY/MM/DDTHH:mm:ssZ",
"YYYY/MM/DDTHH:mm:ss.SSSZ",
];
+// Keep global date-time formats compatible with the backend; the data grid can
+// additionally render Day.js 12-hour display patterns locally.
+export const DataGridDateTimePatterns = [...DateTimePatterns, "YYYY-MM-DD hh:mm:ss A"];
const SUPPORTED_DATE_TIME_PATTERN_TOKENS = ["YYYY", "SSS", "ZZ", "MM", "DD", "HH", "mm", "ss", "M", "D", "H", "m", "s", "Z"];
const STRICT_LOCAL_DATETIME_INPUT_PATTERNS = [
"YYYY-MM-DD",
@@ -72,6 +75,14 @@ interface IntlTimeZoneSupport {
supportedValuesOf?: (key: "timeZone") => string[];
}
+const TIME_ZONE_DISPLAY_ALIASES: Record<string, string> = {
+ "Asia/Calcutta": "Asia/Kolkata",
+};
+
+export function displayTimeZoneOption(timeZone: string): string {
+ return TIME_ZONE_DISPLAY_ALIASES[timeZone] ?? timeZone;
+}
+
export function getSupportedTimeZoneOptions(intl: IntlTimeZoneSupport, fallbackTimeZone = "UTC"): string[] {
try {
const timeZones = intl.supportedValuesOf?.("timeZone");