Skip to content

Commit ae15a12

Browse files
author
Winni Neessen
committed
Refactor SetDate to use SetDateWithValue
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.
1 parent ea5b02b commit ae15a12

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

msg.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,7 @@ func (m *Msg) SetBulk() {
10871087
// - https://datatracker.ietf.org/doc/html/rfc5322#section-3.3
10881088
// - https://datatracker.ietf.org/doc/html/rfc1123
10891089
func (m *Msg) SetDate() {
1090-
now := time.Now().Format(time.RFC1123Z)
1091-
m.SetGenHeader(HeaderDate, now)
1090+
m.SetDateWithValue(time.Now())
10921091
}
10931092

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

0 commit comments

Comments
 (0)