Commit 237b3035 authored by Volker Krause's avatar Volker Krause
Browse files

Extend SNCF Carte Advantage extractor to cover the validity interval

parent c524a84c
......@@ -507,6 +507,8 @@ function parseSncfCartePdf(pdf, node, barcode) {
carte.member = JsonLd.newObject("Person");
carte.member.familyName = text.match(/Nom\s*:\s*(.*)/)[1];
carte.member.givenName = text.match(/Prénom\s*:\s*(.*)/)[1];
// TODO validity period, once the data model supports that
const validity = text.match(/Du\s+(\d{2}\/\d{2}\/\d{4})\s+au\s+(\d{2}\/\d{2}\/\d{4})/);
carte.validFrom = JsonLd.toDateTime(validity[1], 'dd/MM/yyyy', 'fr');
carte.validTo = JsonLd.toDateTime(validity[2] + ' 23:59:59', 'dd/MM/yyyy hh:mm:ss', 'fr');
return carte;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment