Skip to content

Commit

Permalink
Refactor SetDate to use SetDateWithValue
Browse files Browse the repository at this point in the history
Replaces direct time formatting in SetDate with a call to SetDateWithValue, improving code reusability and readability. The new approach centralizes date formatting logic in one method.
  • Loading branch information
wneessen committed Oct 26, 2024
1 parent ea5b02b commit ae15a12
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,7 @@ func (m *Msg) SetBulk() {
// - https://datatracker.ietf.org/doc/html/rfc5322#section-3.3
// - https://datatracker.ietf.org/doc/html/rfc1123
func (m *Msg) SetDate() {
now := time.Now().Format(time.RFC1123Z)
m.SetGenHeader(HeaderDate, now)
m.SetDateWithValue(time.Now())
}

// SetDateWithValue sets the "Date" header for the Msg using the provided time value in a valid RFC 1123 format.
Expand Down

0 comments on commit ae15a12

Please sign in to comment.