dately 2.0.5__tar.gz → 2.0.10__tar.gz
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.
- {dately-2.0.5 → dately-2.0.10}/PKG-INFO +1 -1
- {dately-2.0.5 → dately-2.0.10}/dately/core.py +3 -2
- {dately-2.0.5 → dately-2.0.10}/dately/timeutils.py +26 -20
- {dately-2.0.5 → dately-2.0.10}/dately.egg-info/PKG-INFO +1 -1
- {dately-2.0.5 → dately-2.0.10}/setup.py +1 -1
- {dately-2.0.5 → dately-2.0.10}/README.md +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/__init__.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/__init__.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/Compiled.cp38-win_amd64.pyd +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/__init__.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/cdatetime/UniversalDateFormatter.cp38-win_amd64.pyd +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/cdatetime/__init__.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/cdatetime/iso8601T.cp38-win_amd64.pyd +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/cdatetime/iso8601Z.cp38-win_amd64.pyd +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/cdatetime/whichformat.cp38-win_amd64.pyd +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/clean_str.cp38-win_amd64.pyd +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/time_zones.cp38-win_amd64.pyd +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/mskutils.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/sysutils.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/timezone.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately/utils.py +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately.egg-info/SOURCES.txt +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately.egg-info/dependency_links.txt +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately.egg-info/requires.txt +0 -0
- {dately-2.0.5 → dately-2.0.10}/dately.egg-info/top_level.txt +0 -0
- {dately-2.0.5 → dately-2.0.10}/setup.cfg +0 -0
|
@@ -33,6 +33,7 @@ from .mold.pyd.Compiled import (
|
|
|
33
33
|
thread.join()
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
|
|
36
37
|
class DatelyDate:
|
|
37
38
|
"""
|
|
38
39
|
A versatile date and datetime utility class for extracting, detecting, converting, and replacing components of date strings.
|
|
@@ -274,7 +275,7 @@ class DatelyDate:
|
|
|
274
275
|
if tzinfo is not None:
|
|
275
276
|
datetime_string = replace_time_by_position(datetime_string, 'tzinfo', tzinfo)
|
|
276
277
|
if time_indicator == '':
|
|
277
|
-
return stripTimeIndicator(datetime_string)
|
|
278
|
+
return remove_marker(stripTimeIndicator(datetime_string))
|
|
278
279
|
|
|
279
280
|
if time_indicator is not None and time_indicator.upper() in ["AM", "PM"]:
|
|
280
281
|
timepattern = anytime_regex
|
|
@@ -286,7 +287,7 @@ class DatelyDate:
|
|
|
286
287
|
result = validate_timezone(datetime_string)
|
|
287
288
|
if result[0] is False:
|
|
288
289
|
raise ValueError
|
|
289
|
-
return datetime_string
|
|
290
|
+
return remove_marker(datetime_string)
|
|
290
291
|
|
|
291
292
|
if isinstance(datetime_strings, str):
|
|
292
293
|
return process(datetime_strings)
|
|
@@ -32,6 +32,7 @@ __all__ = [
|
|
|
32
32
|
"stripTimeZone",
|
|
33
33
|
"validate_timezone",
|
|
34
34
|
"validate_date",
|
|
35
|
+
"remove_marker",
|
|
35
36
|
]
|
|
36
37
|
|
|
37
38
|
def get_time():
|
|
@@ -171,22 +172,22 @@ def stripTimeZone(datetime_string):
|
|
|
171
172
|
|
|
172
173
|
return datetime_string
|
|
173
174
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
#
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
#
|
|
188
|
-
|
|
189
|
-
|
|
175
|
+
def remove_marker(text):
|
|
176
|
+
"""
|
|
177
|
+
Removes ' NO_MERIDIEM_NO_TIMEZONE_NO_OFFSET' from the provided text.
|
|
178
|
+
|
|
179
|
+
Parameters:
|
|
180
|
+
text (str): The input text from which the marker needs to be removed.
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
str: The cleaned text without the specified marker.
|
|
184
|
+
"""
|
|
185
|
+
# Define the regex pattern to match the specific string to remove
|
|
186
|
+
pattern = re.compile(r" NO_MERIDIEM_NO_TIMEZONE_NO_OFFSET")
|
|
187
|
+
|
|
188
|
+
# Replace the matched string with nothing (effectively removing it)
|
|
189
|
+
cleaned_text = pattern.sub("", text)
|
|
190
|
+
return cleaned_text
|
|
190
191
|
|
|
191
192
|
def make_datetime_string(date_string):
|
|
192
193
|
"""
|
|
@@ -327,8 +328,7 @@ def extract_time_fragment(date_time_string, locale=False):
|
|
|
327
328
|
else:
|
|
328
329
|
return match.group(0), None, None
|
|
329
330
|
return None, None, None
|
|
330
|
-
|
|
331
|
-
|
|
331
|
+
|
|
332
332
|
def replace_time_by_position(datetime_string, component, new_value):
|
|
333
333
|
"""
|
|
334
334
|
Modifies a specified component of a time within a datetime string based on provided patterns.
|
|
@@ -353,13 +353,19 @@ def replace_time_by_position(datetime_string, component, new_value):
|
|
|
353
353
|
or if the microsecond value is not a digit.
|
|
354
354
|
"""
|
|
355
355
|
# Validate and adjust the new value based on the component
|
|
356
|
+
## if component == 'hour':
|
|
357
|
+
## new_value = str(max(0, min(23, int(new_value))))
|
|
356
358
|
if component == 'hour':
|
|
357
|
-
|
|
359
|
+
# Check if the input is a string and starts with a '0'
|
|
360
|
+
if isinstance(new_value, str) and new_value.startswith("0") and len(new_value) == 2 and int(new_value) < 10:
|
|
361
|
+
new_value = "0" + str(max(0, min(23, int(new_value))))
|
|
362
|
+
else:
|
|
363
|
+
new_value = str(max(0, min(23, int(new_value))))
|
|
358
364
|
elif component in ['minute', 'second']:
|
|
359
365
|
new_value = str(max(0, min(59, int(new_value)))).zfill(2)
|
|
360
366
|
elif component == 'microsecond':
|
|
361
367
|
if not str(new_value).isdigit():
|
|
362
|
-
return datetime_string
|
|
368
|
+
return datetime_string
|
|
363
369
|
|
|
364
370
|
time_component_pattern = gtf(component)
|
|
365
371
|
gt_time_pattern_match = timeboundary_regex.search(datetime_string)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dately-2.0.5 → dately-2.0.10}/dately/mold/pyd/cdatetime/UniversalDateFormatter.cp38-win_amd64.pyd
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|