Skip to content

Commit

Permalink
Replace deprecated ISO8601 formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Aug 26, 2024
1 parent 84e8f16 commit 1b6d81d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 6 additions & 0 deletions beam-sqlite/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.5.3.1

# Added features

* Replaced use of deprecated functions.

# 0.5.3.0

# Added features
Expand Down
7 changes: 3 additions & 4 deletions beam-sqlite/Database/Beam/Sqlite/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import qualified Data.Text.Lazy as TL
import Data.Time
import qualified Data.Time.Format.ISO8601 as Time
import Data.Word
#if !MIN_VERSION_base(4, 11, 0)
import Data.Semigroup
Expand Down Expand Up @@ -966,12 +967,10 @@ instance HasSqlValueSyntax SqliteValueSyntax UTCTime where
sqlValueSyntax tm = SqliteValueSyntax (emitValue (toField tm))

instance HasSqlValueSyntax SqliteValueSyntax LocalTime where
sqlValueSyntax tm = SqliteValueSyntax (emitValue (SQLText (fromString tmStr)))
where tmStr = formatTime defaultTimeLocale (iso8601DateFormat (Just "%H:%M:%S%Q")) tm
sqlValueSyntax tm = SqliteValueSyntax (emitValue (SQLText (fromString (Time.formatShow Time.iso8601Format tm))))

instance HasSqlValueSyntax SqliteValueSyntax Day where
sqlValueSyntax tm = SqliteValueSyntax (emitValue (SQLText (fromString tmStr)))
where tmStr = formatTime defaultTimeLocale (iso8601DateFormat Nothing) tm
sqlValueSyntax tm = SqliteValueSyntax (emitValue (SQLText (fromString (Time.formatShow Time.iso8601Format tm))))

instance HasDataTypeCreatedCheck SqliteDataTypeSyntax where
dataTypeHasBeenCreated _ _ = True
2 changes: 1 addition & 1 deletion beam-sqlite/beam-sqlite.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: beam-sqlite
version: 0.5.3.0
version: 0.5.3.1
synopsis: Beam driver for SQLite
description: Beam driver for the <https://sqlite.org/ SQLite> embedded database.
See <https://haskell-beam.github.io/beam/user-guide/backends/beam-sqlite/ here>
Expand Down

0 comments on commit 1b6d81d

Please sign in to comment.