-
-
Save jdrago999/284d327693518263331bb6b3534adecc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const datetimeWithTZ = <T extends ColumnBaseConfig>( | |
column: MySqlDateTimeString<T> | |
) => | |
sql`DATE_FORMAT(${column}, '%Y-%m-%dT%TZ')`.mapWith((v) => new Date(v)); | |
// example | |
// await db.select({ createdAt: datetimeWithTz(table.createdAt) }).from(table); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment