Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: tweak comments for timestamp formatter (#13912)

boojackcee85c450603
diff --git a/frontend/src/utils/v1/sql.ts b/frontend/src/utils/v1/sql.ts
index f423314f83..c0e8bb2fbc 100644
--- a/frontend/src/utils/v1/sql.ts
+++ b/frontend/src/utils/v1/sql.ts
@@ -53,13 +53,17 @@ export const extractSQLRowValue = (
const fullDayjs = dayjs(getDateForPbTimestamp(timestampValue));
const microseconds = Math.floor(timestampValue.nanos / 1000);
const timezoneOffset = fullDayjs.format("Z");
+ // Format the timestamp into a human-readable string, including microseconds if present
const formattedTimestamp =
microseconds > 0
- ? `${fullDayjs.format("YYYY-MM-DDTHH:mm:ss")}.${microseconds.toString().padStart(6, "0")}${timezoneOffset}`
- : `${fullDayjs.format("YYYY-MM-DDTHH:mm:ss")}${timezoneOffset}`;
+ ? // If there are microseconds, append them to the formatted string with 6 digits.
+ // Example: 2021-01-01T00:00:00.123456+0000
+ `${fullDayjs.format("YYYY-MM-DDTHH:mm:ss")}.${microseconds.toString().padStart(6, "0")}${timezoneOffset}`
+ : // Otherwise, just format the date and time without microseconds
+ // Example: 2021-01-01T00:00:00+0000
+ `${fullDayjs.format("YYYY-MM-DDTHH:mm:ss")}${timezoneOffset}`;
return {
- // Use the conditionally formatted timestamp
plain: formattedTimestamp,
raw: timestampValue,
};