Date text encoding pads year with 0 for at least 4 digits
e.g. 0007-01-02 instead of 7-01-02 https://github.com/jackc/pgx/commit/89f69aaea9748ae0ea121af4f1886d24966cef56#commitcomment-89173737
This commit is contained in:
+5
-1
@@ -193,7 +193,11 @@ func (encodePlanDateCodecText) Encode(value any, buf []byte) (newBuf []byte, err
|
||||
bc = true
|
||||
}
|
||||
|
||||
buf = strconv.AppendInt(buf, int64(year), 10)
|
||||
yearBytes := strconv.AppendInt(make([]byte, 0, 6), int64(year), 10)
|
||||
for i := len(yearBytes); i < 4; i++ {
|
||||
buf = append(buf, '0')
|
||||
}
|
||||
buf = append(buf, yearBytes...)
|
||||
buf = append(buf, '-')
|
||||
if date.Time.Month() < 10 {
|
||||
buf = append(buf, '0')
|
||||
|
||||
Reference in New Issue
Block a user