Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make spaces in separator configurable #41

Closed
wants to merge 1 commit into from
Closed

Make spaces in separator configurable #41

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 1, 2022

The current implementation of from_range_text() allows to define the separator, but has hardcoded spaces around them. This is not always the case (see as an example, the STAC api specs datetime uses ).

Suggesting to remove the hardcoded spaces and make them configurable through the separator argument.

@@ -836,7 +836,7 @@ def __normalize_datetime_value(self, value, timezone):
def from_range_text(
cls,
range_text: str,
separator: str = "-",
separator: str = " - ",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exactly equivalent to the current behavior.
How about make it possible to specify a separator as a regular expression.
This will allows for more flexible designations.

thombashi added a commit that referenced this pull request Feb 11, 2023
…nge_text method: #41

Co-authored-by: Felix Delattre <felix.delattre@up42.com>
@thombashi
Copy link
Owner

Since DateTimeRange 2.0.0, you can specify a regular expression as separator.
Thank you for your contribution.

@thombashi thombashi closed this Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants