MCPcopy Index your code
hub / github.com/OWASP/Python-Honeypot / fix_date

Function fix_date

api/utility.py:123–154  ·  view source on GitHub ↗

fix date value from user input Args: date: date value - user input Returns: an array with fixed date value or original date

(date)

Source from the content-addressed store, hash-verified

121
122
123def fix_date(date):
124 """
125 fix date value from user input
126
127 Args:
128 date: date value - user input
129
130 Returns:
131 an array with fixed date value or original date
132 """
133 if date:
134 if date.count(":") == 2:
135 return [
136 date,
137 "{0} 23:59:59".format(
138 date.rsplit()[0]
139 )
140 ]
141 elif date.count("|") == 1 and date.count(":") == 4:
142 return date.rsplit("|")
143 elif date.count("|") == 1 and date.count(":") == 0:
144 return [
145 "{0} 00:00:00".format(
146 date.rsplit("|")[0]
147 ),
148 "{0} 23:59:59".format(
149 date.rsplit("|")[1]
150 )
151 ]
152 else:
153 return "{0} 00:00:00|{0} 23:59:59".format(date).rsplit("|")
154 return date
155
156
157def fix_limit(limit):

Callers 2

test_fix_dateMethod · 0.90
filter_by_dateFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_fix_dateMethod · 0.72