mirror of
https://github.com/stalwartlabs/mail-parser.git
synced 2026-12-04 08:01:42 +00:00
Zero offset timezones should be positive (#17)
This commit is contained in:
1 parent
9f1edeed33
commit
d157525b1c
1 file changed
+6
-1
@@ -16,6 +16,11 @@ use crate::{parsers::message::MessageStream, DateTime, HeaderValue};
|
||||
impl DateTime {
|
||||
/// Returns an ISO-8601 representation of the parsed RFC5322 datetime field
|
||||
pub fn to_iso8601(&self) -> String {
|
||||
let tz_sign = if self.tz_before_gmt && (self.tz_hour > 0 || self.tz_minute > 0) {
|
||||
"-"
|
||||
} else {
|
||||
"+"
|
||||
};
|
||||
format!(
|
||||
"{:04}-{:02}-{:02}T{:02}:{:02}:{:02}{}{:02}:{:02}",
|
||||
self.year,
|
||||
@@ -24,7 +29,7 @@ impl DateTime {
|
||||
self.hour,
|
||||
self.minute,
|
||||
self.second,
|
||||
if self.tz_before_gmt { "-" } else { "+" },
|
||||
tz_sign,
|
||||
self.tz_hour,
|
||||
self.tz_minute
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user