Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions utils/typeutils/reformat.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ func ReformatDate(v interface{}) (time.Time, error) {
}

// manage year limit
// even after data being parsed if year doesn't lie in range [0,9999] it failed to get marshaled
if parsed.Year() < 0 {
parsed = parsed.AddDate(0-parsed.Year(), 0, 0)
// even after data being parsed if year doesn't lie in range [1,9999] it failed to get marshaled
if parsed.Year() <= 0 {
parsed = parsed.AddDate(1-parsed.Year(), 0, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Itz-Agasta
hey can you provide the example using which you tested? I mean if possible the mongodb script if possible.

} else if parsed.Year() > 9999 {
parsed = parsed.AddDate(-(parsed.Year() - 9999), 0, 0)
}
Expand Down