Issue Description
On v1.0.0, with AddressBook.vCardVersion set to v3, Stalwart serves a birthday without a year as BDAY:–03-15. When a client uploads that same value in a vCard 3.0 card, Stalwart stores only the month and drops the day. The PUT returns 201 and nothing is logged. The month-only date is then written as BDAY:–3 in both 3.0 and 4.0. So a 3.0 client that saves back a card it got from Stalwart (for example after the user edits another field) silently loses the day of a yearless birthday. We set v3 because iPhone Contacts never asks for a version and reads 4.0 as Latin-1 (t/405).
Expected Behavior
Stalwart reads back the value it writes: BDAY:–03-15 in a 3.0 card is stored as month 3, day 15 and served again as --03-15 (3.0) or --0315 (4.0). A month-only date is written zero-padded, --03, as in the RFC 6350 §4.3.1 examples.
Actual Behavior
Uploaded
Served as 3.0
Served as 4.0
3.0, BDAY:–03-15
BDAY:–3
BDAY:–3
3.0, BDAY:–0315
BDAY:–03-15
BDAY:–0315
4.0, BDAY:–0315
BDAY:–03-15
BDAY:–0315
3.0, BDAY;X-APPLE-OMIT-YEAR=1604:1604-03-15
unchanged
…:16040315
The first row is the problem: its input is exactly what rows 2 and 3 serve as 3.0. Apple’s own form in row 4 round-trips correctly (fixed with t/2000).
In the source at v1.0.0: push_legacy_vcard writes a month and day without a year as --MM-DD (crates/calcard/src/vcard/writer.rs:465-470). On upload, parse_vcard_date_legacy (vcard/parser.rs:749) needs a full year-month-day, so --03-15 falls back to parse_vcard_date (lines 868-877). That function reads 03 as the month, then reads the day with parse_small_digits(…, false), which stops at the - before 15. The rest is ignored and the date is not null, so it counts as a successful parse. The month-only arm (None, Some(month), None) in both writers uses push_u64 instead of push_2_digits (writer.rs:369-371 and 478-480), hence --3.
A possible fix: accept the - before the day in parse_vcard_date, and use push_2_digits in both month-only arms. Optionally, write a yearless 3.0 date in Apple’s X-APPLE-OMIT-YEAR=1604 form, which Stalwart already round-trips, since RFC 2426 has no truncated dates.
Reproduction Steps
Set AddressBook.vCardVersion to v3 and restart.
PUT to /dav/card//default/probe.vcf:
BEGIN:VCARD
VERSION:3.0
UID:probe
FN:Probe
N:Probe;;;;
BDAY:–03-15
END:VCARD
GET the card with no Accept header → BDAY:–3.
GET it with Accept: text/vcard; version=4.0 → BDAY:–3.
Repeat with BDAY:–0315 instead. GET with no Accept header returns BDAY:–03-15, which is the value from step 2.
Stalwart Version
v1.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
OIDC
Additional Context
Found with curl against v1.0.0; the only relevant setting is AddressBook.vCardVersion = v3. The configuration is applied as JMAP objects with stalwart-cli apply. We have not checked yet whether iOS Contacts sends --03-15 back unchanged.
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on