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

Modify date-related functions to optionally split on multiple chars #1871

Closed

Conversation

rdswift
Copy link
Collaborator

@rdswift rdswift commented Jul 27, 2021

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences: Add option to split input date string on single character (default) or multiple characters.

Problem

  • JIRA ticket (optional): PICARD-XXX

The current version (not yet released) of the $year(), $month(), $day() and $dateformat() scripting functions splits the input date string on one or more non-digit characters. This leads to unexpected results such as $month(2021--16) returning "16" rather than the expected "".

Solution

Split the input date string at each non-digit character and add an option to trigger the split at one or more non-digit character.

Action

Remember to update the documentation.

@rdswift rdswift mentioned this pull request Jul 27, 2021
34 tasks
@zas
Copy link
Collaborator

zas commented Jul 30, 2021

This leads to unexpected results such as $month(2021--16) returning "16" rather than the expected "".

Actually I'm not sure what to expect in such case. Dates are usually separated by one character, or none in the case of "YYYYMMDD" format (I would rather support that), but very rarely by more than one character, or those are whitespaces ("2021 - 12 - 17"). I really don't expect "2021--16" to be a valid format.

I'm not fond of this move as it makes code more complex, or we should let the user specifies a full format (which would lead to extra complexity too).

Did we get reports from users asking for this?

@rdswift
Copy link
Collaborator Author

rdswift commented Jul 30, 2021

I'm not fond of this move as it makes code more complex, or we should let the user specifies a full format (which would lead to extra complexity too).

Good point.

Did we get reports from users asking for this?

Just from me, and I can live without it. Would you like me to cancel this PR?

@phw
Copy link
Member

phw commented Jul 30, 2021

I agree with zas on this.

@rdswift rdswift closed this Jul 30, 2021
@rdswift rdswift deleted the date-related_function_changes branch July 30, 2021 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants