Fix replacedate to handle empty input; see Issue #192#256
Open
tomio13 wants to merge 6 commits intosplitbrain:masterfrom
Open
Fix replacedate to handle empty input; see Issue #192#256tomio13 wants to merge 6 commits intosplitbrain:masterfrom
tomio13 wants to merge 6 commits intosplitbrain:masterfrom
Conversation
DATE() will return 1970-01-01 for an empty input. Now, if using a year or part of the date to create namespaces dynamically, this can throw things quite off. This patch adds a check if the supplied date is empty or the strototime() throws an error, and returns an empty string for this case. This behavior is especially useful for complex forms, where multiple input is possible for the date, and either one or the other is valid only. In my example, running projects and planned projects evaluate differently, and the namespace is composed dynamically based on the input.
I am using it in a setting where the created forms are sorted according to entry year, but in special cases, planned content has no date. The original would throw the planned content to year 1970, which is a very much not desired behavior. Now the replacedate() will return empty string for empty input. P.s.: I am new to github and have difficulties getting my commit submitted properly. I am sorry if i am generating noise. T.
Owner
|
can you remove the patch file from the PR please? |
Author
|
#This e-mail is a reply to the message of Andreas Gohr
<notifications@github.com>, sent on Sun, 28 Oct 2018 05:42:56 -0700:
#"
can you remove the patch file from the PR please?
#end of previous message"
sure. Done.
T.
|
Author
|
Any reason why this does not get merged? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DATE() will return 1970-01-01 for an empty input. Now, if using a year or part of the date to create namespaces dynamically, this can throw things quite off. This patch adds a check if the supplied date is empty or the strototime() throws an error, and returns an empty string for this case.
This behavior is especially useful for complex forms, where multiple input is possible for the date, and either one or the other is valid only. In my example, running projects and planned projects evaluate differently, and the namespace is composed dynamically based on the input.