This version of the module is deprecated: Use moonbitlang/pdflite instead
flowchart LR
String["D:YYYYMMDDHHmmSSOHH'mm'"] --> Parser[pdf_date_of_string]
Bytes[PDF bytes] --> Parser
Parser --> PdfDate
PdfDate --> Writer[pdf_string_of_date]
Writer --> Out[PDF date string]///|
test "date strings round trip" {
let input = "D:20240515112233+08'00'"
let date = try! pdf_date_of_string(input)
inspect(try! pdf_string_of_date(date), content=input)
}///|
test "bad date syntax raises shared PdfError" {
let result : Result[PdfDate, Error] = try? pdf_date_of_string("not a date")
guard result is Err(@core.PdfError::BadDate) else {
fail("expected BadDate for malformed PDF date text")
}
}