ipiranga-inovai-project-lib 4.0__py3-none-any.whl → 4.1__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
@@ -1,13 +1,13 @@
1
1
  import logging
2
+ from datetime import datetime
2
3
 
3
- from dateutil import parser
4
4
 
5
-
6
- def format_date(date_str, formatter: str = '%d/%m/%Y') -> str:
5
+ def format_date(date_str, date_str_format: str = '%d/%m/%Y', new_format: str = None) -> str:
7
6
  try:
8
- date_obj = parser.parse(date_str)
9
- date_formatted = date_obj.strftime(formatter)
10
- return date_formatted
11
- except ValueError:
12
- logging.error(f"Formato de data invalido. Data {date_str}")
7
+ date_obj = datetime.strptime(date_str, date_str_format)
8
+ if new_format:
9
+ return date_obj.strftime(new_format)
10
+ return date_obj.strftime(date_str_format)
11
+ except Exception as e:
12
+ logging.error(f"Formato de data invalido. Data {date_str}, formato esperado: {date_str_format}", e)
13
13
  return ''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipiranga-inovai-project-lib
3
- Version: 4.0
3
+ Version: 4.1
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=tEFFoYhtyZk2pxor2vb23NWr3otPzPXTiTIf-VrGik4,366
37
- ipiranga_inovai_project_lib-4.0.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
38
- ipiranga_inovai_project_lib-4.0.dist-info/METADATA,sha256=MF3MjnyiilozNYYrkP3FJzwGKWHrRmD2KRrxSbpH4vI,518
39
- ipiranga_inovai_project_lib-4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
- ipiranga_inovai_project_lib-4.0.dist-info/top_level.txt,sha256=BD-APH5oIEb_KDXwrfnZiu9QDsD9ttTEkYc32r9thqg,7
41
- ipiranga_inovai_project_lib-4.0.dist-info/RECORD,,
36
+ inovai/utils/util.py,sha256=eRDwHv5h6h6sjiryY0GTr545Dp9WY9YDkMF7ovU5j28,501
37
+ ipiranga_inovai_project_lib-4.1.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
38
+ ipiranga_inovai_project_lib-4.1.dist-info/METADATA,sha256=4RvYcauDywbfyPfvirbxYEFlUmJFhvGlXn3RFpMEihE,518
39
+ ipiranga_inovai_project_lib-4.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
+ ipiranga_inovai_project_lib-4.1.dist-info/top_level.txt,sha256=BD-APH5oIEb_KDXwrfnZiu9QDsD9ttTEkYc32r9thqg,7
41
+ ipiranga_inovai_project_lib-4.1.dist-info/RECORD,,