mirror of
				https://github.com/searxng/searxng.git
				synced 2025-11-04 03:27:06 -05:00 
			
		
		
		
	[fix] exception if locale doesn't have a date format
occitan, for example
This commit is contained in:
		
							parent
							
								
									93ef11adc0
								
							
						
					
					
						commit
						a4c77f88d0
					
				@ -206,7 +206,13 @@ def format_date_by_locale(date, locale_string):
 | 
				
			|||||||
    if locale_string == 'all':
 | 
					    if locale_string == 'all':
 | 
				
			||||||
        locale_string = settings['ui']['default_locale'] or 'en_US'
 | 
					        locale_string = settings['ui']['default_locale'] or 'en_US'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return format_date(date, locale=locale_string)
 | 
					    # to avoid crashing if locale is not supported by babel
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        formatted_date = format_date(date, locale=locale_string)
 | 
				
			||||||
 | 
					    except:
 | 
				
			||||||
 | 
					        formatted_date = format_date(date, "YYYY-MM-dd")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return formatted_date
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def dict_subset(d, properties):
 | 
					def dict_subset(d, properties):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user