рефакторинг года

master
Sipachev Igor 3 years ago
parent 4e7a1adf56
commit 3411794a08
  1. 14
      popup/src/classes/Service/Generators/PersonalIdGenerator.ts

@ -8,11 +8,7 @@ export class PersonalIdGenerator {
* @param person
*/
generate (person: Person) {
let fullYear = person.birthday.year
if (!fullYear) {
const e = (new Date()).getFullYear()
fullYear = BigInt(randomGenerator.generate(e - 5, e - 55))
}
const fullYear = this.grabFullYear(person.birthday.year)
const year = this.getYearPart(fullYear)
const month = this.getMonthPart(person.birthday.month)
const day = this.getDayPart(person.birthday.day)
@ -24,6 +20,14 @@ export class PersonalIdGenerator {
return a + year + month + day + o + l2
}
grabFullYear (year: bigint | null): bigint {
if (!year) {
const e = (new Date()).getFullYear()
year = BigInt(randomGenerator.generate(e - 5, e - 55))
}
return year
}
/**
* e.getYearPart = function () {
var e = (new Date).getFullYear();

Loading…
Cancel
Save