mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-11-13 09:31:46 +01:00
archivist: use expr standard date(value, layout) builtin instead of custom parseDate
This commit is contained in:
@@ -35,11 +35,11 @@
|
|||||||
// rules : child rules, evaluated in order only if the parent "when"
|
// rules : child rules, evaluated in order only if the parent "when"
|
||||||
// matched; nesting is recursive
|
// matched; nesting is recursive
|
||||||
//
|
//
|
||||||
// Built-in helpers: firstMatch(regex) returns the first match of the regex
|
// Built-in helper: firstMatch(regex) returns the first match of the regex
|
||||||
// in the first-page text (first capture group when present).
|
// in the first-page text (first capture group when present).
|
||||||
// parseDate(value, layout) parses a string into a native date (Go layout,
|
// Strings are parsed into native dates with expr's standard date(value,
|
||||||
// e.g. `02/01/2006` for 15/01/2026); the format is carried by the rule so
|
// layout) builtin (Go layout, e.g. `02/01/2006` for 15/01/2026); the
|
||||||
// it can differ per document type.
|
// format is carried by the rule so it can differ per document type.
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
"rules": [
|
"rules": [
|
||||||
// --- Generic extraction, runs for every document -------------------------
|
// --- Generic extraction, runs for every document -------------------------
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
{
|
{
|
||||||
"when": "true",
|
"when": "true",
|
||||||
"set": [
|
"set": [
|
||||||
{ "field": "date", "eval": "parseDate(firstMatch(`[0-9]{2}/[0-9]{2}/[0-9]{4}`), `02/01/2006`)" }
|
{ "field": "date", "eval": "date(firstMatch(`[0-9]{2}/[0-9]{2}/[0-9]{4}`), `02/01/2006`)" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user