mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Move padding into date formatter
This commit is contained in:
@@ -42,7 +42,11 @@ export class LocalizedDateParserFormatter extends NgbDateParserFormatter {
|
||||
let inputFormat = this.getDateInputFormat()
|
||||
let dateSeparator = inputFormat.replace(/[dmy]/gi, '').charAt(0)
|
||||
|
||||
value = value.replace(/[\/,\.-]/g, '')
|
||||
if ([',','.','/','-'].some(sep => value.includes(sep))) {
|
||||
let valArr = value.split(/[\.,\/-]+/)
|
||||
valArr = valArr.map(segment => segment.padStart(2,'0'))
|
||||
value = valArr.join('')
|
||||
}
|
||||
|
||||
if (value.length == 4 && inputFormat.substring(0, 4) != 'yyyy') {
|
||||
return [value.substring(0, 2), value.substring(2, 4), new Date().getFullYear()].join(dateSeparator)
|
||||
|
Reference in New Issue
Block a user