ipiranga-inovai-project-lib 4.2__py3-none-any.whl → 4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
inovai/utils/util.py CHANGED
@@ -3,11 +3,22 @@ from datetime import datetime
3
3
 
4
4
 
5
5
  def format_date(date_str, date_str_format: str = '%d/%m/%Y', new_format: str = None) -> str:
6
+
6
7
  try:
7
- date_obj = datetime.strptime(date_str, date_str_format)
8
+ if "T" in date_str and "Z" in date_str:
9
+ date_obj = datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%SZ")
10
+ elif " " in date_str and ":" in date_str:
11
+ date_obj = datetime.strptime(date_str, "%Y-%m-%d %H:%M:%S")
12
+ else:
13
+ date_obj = datetime.strptime(date_str, date_str_format)
14
+
8
15
  if new_format:
9
16
  return date_obj.strftime(new_format)
17
+
10
18
  return date_obj.strftime(date_str_format)
19
+ except ValueError as ve:
20
+ logging.error(f"Formato de data inválido. Data '{date_str}', formato esperado: '{date_str_format}'. Erro: {ve}")
21
+ raise
11
22
  except Exception as e:
12
- logging.error(f"Formato de data invalido. Data {date_str}, formato esperado: {date_str_format}", e)
13
- return ''
23
+ logging.error(f"Erro inesperado ao formatar a data '{date_str}': {e}")
24
+ raise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipiranga-inovai-project-lib
3
- Version: 4.2
3
+ Version: 4.3
4
4
  Summary: Projeto criado para importação genérica de entidades
5
5
  Home-page: https://gitlab.ipirangacloud.com/clayton.monteiro.ext/ipiranga-inovai-project-lib
6
6
  Author: Clayton Sandes Monteiro
@@ -33,9 +33,9 @@ inovai/models/NFeVeiculo.py,sha256=iwnD0uZjHU2l4J_QP7JW9EQpJZWDYCEIhRxpWrvxtns,1
33
33
  inovai/models/NFeVolume.py,sha256=_cayb-rrz1mSxQ3wFFnB4KCi524jtAsdTTcS4WQTBOc,1970
34
34
  inovai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  inovai/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- inovai/utils/util.py,sha256=eRDwHv5h6h6sjiryY0GTr545Dp9WY9YDkMF7ovU5j28,501
37
- ipiranga_inovai_project_lib-4.2.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
38
- ipiranga_inovai_project_lib-4.2.dist-info/METADATA,sha256=VNBAtOQM345erOgVYoLQKsm8mR3qx3iVHUWVkitKi6A,518
39
- ipiranga_inovai_project_lib-4.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
- ipiranga_inovai_project_lib-4.2.dist-info/top_level.txt,sha256=BD-APH5oIEb_KDXwrfnZiu9QDsD9ttTEkYc32r9thqg,7
41
- ipiranga_inovai_project_lib-4.2.dist-info/RECORD,,
36
+ inovai/utils/util.py,sha256=CsxaZmeKWG8A4w_1XzVm_F9hdWkDVgmHDYL2XF8v5dQ,906
37
+ ipiranga_inovai_project_lib-4.3.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
38
+ ipiranga_inovai_project_lib-4.3.dist-info/METADATA,sha256=xdVDnBWH-8dY_YBdnmpWjtJ_oKI4oOZSjK2DbOjUb6Q,518
39
+ ipiranga_inovai_project_lib-4.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
+ ipiranga_inovai_project_lib-4.3.dist-info/top_level.txt,sha256=BD-APH5oIEb_KDXwrfnZiu9QDsD9ttTEkYc32r9thqg,7
41
+ ipiranga_inovai_project_lib-4.3.dist-info/RECORD,,