mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	ruff: Fix DTZ007 datetime.datetime.strptime() without %z.
				
					
				
			Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							b5cad938b8
						
					
				
				
					commit
					3e10ceb022
				
			| @@ -30,7 +30,7 @@ for any particular type of object. | ||||
| import re | ||||
| import sys | ||||
| from dataclasses import dataclass | ||||
| from datetime import datetime | ||||
| from datetime import datetime, timezone | ||||
| from decimal import Decimal | ||||
| from typing import ( | ||||
|     Any, | ||||
| @@ -147,7 +147,10 @@ def check_date(var_name: str, val: object) -> str: | ||||
|     if not isinstance(val, str): | ||||
|         raise ValidationError(_("{var_name} is not a string").format(var_name=var_name)) | ||||
|     try: | ||||
|         if datetime.strptime(val, "%Y-%m-%d").strftime("%Y-%m-%d") != val: | ||||
|         if ( | ||||
|             datetime.strptime(val, "%Y-%m-%d").replace(tzinfo=timezone.utc).strftime("%Y-%m-%d") | ||||
|             != val | ||||
|         ): | ||||
|             raise ValidationError(_("{var_name} is not a date").format(var_name=var_name)) | ||||
|     except ValueError: | ||||
|         raise ValidationError(_("{var_name} is not a date").format(var_name=var_name)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user