Use date of laws for commits (when >= 1971-01-01)
This commit is contained in:
parent
ef547376fa
commit
05a6704a13
1 changed files with 21 additions and 0 deletions
|
@ -85,6 +85,10 @@ interface TexteManquant {
|
||||||
date: string
|
date: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const minDateObject = new Date("1971-01-01")
|
||||||
|
const minDateTimestamp = Math.floor(minDateObject.getTime() / 1000)
|
||||||
|
const oneDay = 24 * 60 * 60 // hours * minutes * seconds
|
||||||
|
|
||||||
async function addArticleToTree(
|
async function addArticleToTree(
|
||||||
context: Context,
|
context: Context,
|
||||||
tree: TextelrNode,
|
tree: TextelrNode,
|
||||||
|
@ -841,12 +845,29 @@ async function exportConsolidatedTextToGit(
|
||||||
.map(([key, value]) => `${key}: ${value}`)
|
.map(([key, value]) => `${key}: ${value}`)
|
||||||
.join("\n")
|
.join("\n")
|
||||||
}
|
}
|
||||||
|
const dateObject = new Date(date)
|
||||||
|
let timestamp = Math.floor(dateObject.getTime() / 1000)
|
||||||
|
if (timestamp < minDateTimestamp) {
|
||||||
|
const diffDays = Math.round(
|
||||||
|
Math.abs((minDateTimestamp - timestamp) / oneDay),
|
||||||
|
)
|
||||||
|
timestamp = minDateTimestamp - diffDays
|
||||||
|
}
|
||||||
|
const timezoneOffset = 0
|
||||||
await git.commit({
|
await git.commit({
|
||||||
dir: targetDir,
|
dir: targetDir,
|
||||||
fs,
|
fs,
|
||||||
author: {
|
author: {
|
||||||
email: "codes_juridiques@tricoteuses.fr",
|
email: "codes_juridiques@tricoteuses.fr",
|
||||||
name: "République française",
|
name: "République française",
|
||||||
|
timestamp,
|
||||||
|
timezoneOffset,
|
||||||
|
},
|
||||||
|
committer: {
|
||||||
|
email: "codes_juridiques@tricoteuses.fr",
|
||||||
|
name: "République française",
|
||||||
|
timestamp,
|
||||||
|
timezoneOffset,
|
||||||
},
|
},
|
||||||
message: [modifyingTextTitle, summary, messageLines]
|
message: [modifyingTextTitle, summary, messageLines]
|
||||||
.filter((block) => block !== undefined)
|
.filter((block) => block !== undefined)
|
||||||
|
|
Loading…
Add table
Reference in a new issue