mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Code formatting
This commit is contained in:
parent
ef4dc1b49e
commit
a33dce1948
@ -45,41 +45,16 @@ export class LocalizedDateParserFormatter extends NgbDateParserFormatter {
|
|||||||
value = value.replace(/[\/,\.-]/g, '')
|
value = value.replace(/[\/,\.-]/g, '')
|
||||||
|
|
||||||
if (value.length == 4 && inputFormat.substring(0, 4) != 'yyyy') {
|
if (value.length == 4 && inputFormat.substring(0, 4) != 'yyyy') {
|
||||||
return value.substring(0, 2)
|
return [value.substring(0, 2), value.substring(2, 4), new Date().getFullYear()].join(dateSeparator)
|
||||||
+ dateSeparator
|
} else if (value.length == 4 && inputFormat.substring(0, 4) == 'yyyy') {
|
||||||
+ value.substring(2, 4)
|
return [new Date().getFullYear(), value.substring(0, 2), value.substring(2, 4)].join(dateSeparator)
|
||||||
+ dateSeparator
|
} else if (value.length == 6) {
|
||||||
+ new Date().getFullYear()
|
return [value.substring(0, 2), value.substring(2, 4), value.substring(4, 6)].join(dateSeparator)
|
||||||
}
|
} else if (value.length == 8 && inputFormat.substring(0, 4) != 'yyyy') {
|
||||||
else if (value.length == 4 && inputFormat.substring(0, 4) == 'yyyy') {
|
return [value.substring(0, 2), value.substring(2, 4), value.substring(4, 8)].join(dateSeparator)
|
||||||
return new Date().getFullYear()
|
} else if (value.length == 8 && inputFormat.substring(0, 4) == 'yyyy') {
|
||||||
+ dateSeparator
|
return [value.substring(0, 4), value.substring(4, 6), value.substring(6, 8)].join(dateSeparator)
|
||||||
+ value.substring(0, 2)
|
} else {
|
||||||
+ dateSeparator
|
|
||||||
+ value.substring(2, 4)
|
|
||||||
}
|
|
||||||
else if (value.length == 6) {
|
|
||||||
return value.substring(0, 2)
|
|
||||||
+ dateSeparator
|
|
||||||
+ value.substring(2, 4)
|
|
||||||
+ dateSeparator
|
|
||||||
+ value.substring(4, 6)
|
|
||||||
}
|
|
||||||
else if (value.length == 8 && inputFormat.substring(0, 4) != 'yyyy') {
|
|
||||||
return value.substring(0, 2)
|
|
||||||
+ dateSeparator
|
|
||||||
+ value.substring(2, 4)
|
|
||||||
+ dateSeparator
|
|
||||||
+ value.substring(4, 8)
|
|
||||||
}
|
|
||||||
else if (value.length == 8 && inputFormat.substring(0, 4) == 'yyyy') {
|
|
||||||
return value.substring(0, 4)
|
|
||||||
+ dateSeparator
|
|
||||||
+ value.substring(4, 6)
|
|
||||||
+ dateSeparator
|
|
||||||
+ value.substring(6, 8)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user