Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
2b78727356 |
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Lightweight Postgres ORM for Nim."
|
description = "Lightweight Postgres ORM for Nim."
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
|
@ -90,11 +90,14 @@ proc parsePGDatetime*(val: string): DateTime =
|
|||||||
if match.isSome:
|
if match.isSome:
|
||||||
let c = match.get.captures
|
let c = match.get.captures
|
||||||
try:
|
try:
|
||||||
let corrected = c[0] & alignLeft(c[1], 3, '0') & c[2]
|
if c.toSeq.len == 2:
|
||||||
return corrected.parse(PG_TIMESTAMP_FORMATS[1])
|
let corrected = c[0] & alignLeft(c[1], 3, '0')
|
||||||
|
return corrected.parse(PG_TIMESTAMP_FORMATS[2])
|
||||||
|
else:
|
||||||
|
let corrected = c[0] & alignLeft(c[1], 3, '0') & c[2]
|
||||||
|
return corrected.parse(PG_TIMESTAMP_FORMATS[3])
|
||||||
except:
|
except:
|
||||||
errStr &= "\n\t" & PG_TIMESTAMP_FORMATS[1] &
|
errStr &= "\n\t" & getCurrentExceptionMsg()
|
||||||
" after padding out milliseconds to full 3-digits"
|
|
||||||
|
|
||||||
raise newException(ValueError, "Cannot parse PG date. Tried:" & errStr)
|
raise newException(ValueError, "Cannot parse PG date. Tried:" & errStr)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user