mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-17 02:45:08 +00:00
minor changes in excel import api method
This commit is contained in:
@ -2,8 +2,9 @@
|
||||
web_utils file
|
||||
"""
|
||||
import base64
|
||||
import datetime
|
||||
|
||||
from base.constants import ARTICLE_CARD_IMAGE_FOLDER
|
||||
from base.constants import ARTICLE_CARD_IMAGE_FOLDER, DATE_FORMAT
|
||||
from guardian.utils import upload_image_to_alibaba, upload_base64_image_to_alibaba
|
||||
|
||||
|
||||
@ -40,3 +41,21 @@ def get_image_url(data):
|
||||
# upload image on ali baba
|
||||
image_url = upload_image_to_alibaba(image, filename)
|
||||
return image_url
|
||||
|
||||
|
||||
def get_dates(start_date, end_date):
|
||||
"""
|
||||
to get start and end date
|
||||
:param start_date: format (yyyy-mm-dd)
|
||||
:param end_date: format (yyyy-mm-dd)
|
||||
:return: start and end date
|
||||
"""
|
||||
|
||||
if start_date and end_date:
|
||||
start_date = datetime.datetime.strptime(start_date, DATE_FORMAT).date()
|
||||
end_date = datetime.datetime.strptime(end_date, DATE_FORMAT).date()
|
||||
else:
|
||||
end_date = datetime.date.today()
|
||||
start_date = end_date - datetime.timedelta(days=6)
|
||||
|
||||
return start_date, end_date
|
||||
|
Reference in New Issue
Block a user