mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	strip all delimiters
This commit is contained in:
		
							parent
							
								
									0f886be109
								
							
						
					
					
						commit
						ef4dc1b49e
					
				@ -35,16 +35,14 @@ export class LocalizedDateParserFormatter extends NgbDateParserFormatter {
 | 
			
		||||
   * have it expanded to 10.03.2022, in the case of the German format.
 | 
			
		||||
   * (All other formats are also supported)
 | 
			
		||||
   * 
 | 
			
		||||
   * It also replaces commas with the date separator. 
 | 
			
		||||
   * This allows quick entry of the date on the numpad. 
 | 
			
		||||
   * It also strips commas or periods before running formatting, 
 | 
			
		||||
   * which allows quick entry of the date on the numpad. 
 | 
			
		||||
   */
 | 
			
		||||
  private preformatDateInput(value: string): string {
 | 
			
		||||
    let inputFormat = this.getDateInputFormat()
 | 
			
		||||
    let dateSeparator = inputFormat.replace(/[dmy]/gi, '').charAt(0)
 | 
			
		||||
 | 
			
		||||
    value = value.replace(/,/g, dateSeparator)
 | 
			
		||||
 | 
			
		||||
    if (value.includes(dateSeparator)) { return value }
 | 
			
		||||
    value = value.replace(/[\/,\.-]/g, '')
 | 
			
		||||
 | 
			
		||||
    if (value.length == 4 && inputFormat.substring(0, 4) != 'yyyy') {
 | 
			
		||||
      return value.substring(0, 2)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user