mattijah / qkmrzparser Goto Github PK
View Code? Open in Web Editor NEWParse MRZ (Machine Readable Zone) from identity documents using Swift.
License: MIT License
Parse MRZ (Machine Readable Zone) from identity documents using Swift.
License: MIT License
Parsing birth date could be wrong if the current user calendar setting is Buddhist.
Note, Buddhist year is 543 years ahead of AD (year 2020 is equal to 2563 in buddhist year).
To reproduce...
To fix this issue, change the current calendar to a fixed Gregorian year.
So that the code ...
// MRZFieldFormatter.swift
private func birthdate(from string: String) -> Date? {
guard CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: string)) else {
return nil
}
let currentYear = Calendar.current.component(.year, from: Date()) - 2000
let parsedYear = Int(string.substring(0, to: 1))!
let centennial = (parsedYear > currentYear) ? "19" : "20"
return dateFormatter.date(from: centennial + string)
}
The line...
let currentYear = Calendar.current.component(.year, from: Date()) - 2000
Should be changed to ...
let currentYear = Calendar(identifier: .gregorian).component(.year, from: Date()) - 2000
Names with maximal length in TD1 will miss their last character.
Length is 29, but should be 30.
Using spm gives manifest error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.