mirror of
https://github.com/stalwartlabs/mail-parser.git
synced 2026-11-28 08:01:24 +00:00
Fix: parse_date() does not handle UTC+12 and greater (fixes #148)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
mail-parser 0.11.4
|
||||
================================
|
||||
- Reject dates with invalid month names.
|
||||
- `parse_date()` doesn't handle UTC+12 and greater (#148)
|
||||
|
||||
mail-parser 0.11.3
|
||||
================================
|
||||
|
||||
@@ -446,5 +446,47 @@
|
||||
{
|
||||
"header": "Tue, 7 00 2026 19:14:51 +0000",
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"header": "17 May 2026 22:15:15 +1200",
|
||||
"expected": {
|
||||
"year": 2026,
|
||||
"month": 5,
|
||||
"day": 17,
|
||||
"hour": 22,
|
||||
"minute": 15,
|
||||
"second": 15,
|
||||
"tz_before_gmt": false,
|
||||
"tz_hour": 12,
|
||||
"tz_minute": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"header": "17 May 2026 22:15:15 +1345",
|
||||
"expected": {
|
||||
"year": 2026,
|
||||
"month": 5,
|
||||
"day": 17,
|
||||
"hour": 22,
|
||||
"minute": 15,
|
||||
"second": 15,
|
||||
"tz_before_gmt": false,
|
||||
"tz_hour": 13,
|
||||
"tz_minute": 45
|
||||
}
|
||||
},
|
||||
{
|
||||
"header": "17 May 2026 22:15:15 +1400",
|
||||
"expected": {
|
||||
"year": 2026,
|
||||
"month": 5,
|
||||
"day": 17,
|
||||
"hour": 22,
|
||||
"minute": 15,
|
||||
"second": 15,
|
||||
"tz_before_gmt": false,
|
||||
"tz_hour": 14,
|
||||
"tz_minute": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -433,7 +433,7 @@ impl<'x> MessageStream<'x> {
|
||||
hour: parts[3] as u8,
|
||||
minute: parts[4] as u8,
|
||||
second: parts[5] as u8,
|
||||
tz_hour: ((parts[6] / 100) % 12) as u8,
|
||||
tz_hour: ((parts[6] / 100) % 24) as u8,
|
||||
tz_minute: ((parts[6] % 100) % 60) as u8,
|
||||
tz_before_gmt: !is_plus,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user