-
Notifications
You must be signed in to change notification settings - Fork 362
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
Date attribute exists #592
Comments
It seems the Date type validation is not happy with |
@raymondfeng i was just testing it out and unfortunately don't have a fix for that |
Probably related? strongloop/loopback#1009 (comment) |
Is there a fix already for this "exists" problem with date? @raymondfeng @bajtos @ritch function DateType(arg) {
if (arg == null) {
return null;
} else if(typeof arg === 'object' && typeof arg.getTime === 'function') {
if (isNaN(arg.getTime())) {
throw new Error('Invalid date: ' + arg);
}
return arg;
} else if(typeof arg === 'string') {
var d = new Date(arg);
if (isNaN(d.getTime())) {
throw new Error('Invalid date: ' + arg);
}
return d;
} else {
throw new Error('Invalid date: ' + arg);
}
} |
@bajtos unfortunately i don't really know how all this pull request/contributing stuff works... |
@bajtos i have fetched the fork for me, changed the file and pushed it to master on the fork. Somehow i don't understand what to do next? |
@kuskov create a feature branch, it will make your life much easier. Starting on master: # create feature branch
git checkout -b fix-date-exists
# push to the server
git push -u origin fix-date-exists
# switch back to master
git checkout master
# reset back to the original revision from upstream
git reset --hard HEAD^
# force-push to overwrite the history
git push -f Once you have that done, open https://github.com/kuskov/loopback-datasource-juggler in your browser, you should see a white stripe suggesting you to submit a pull request. |
any new updates on this issue? |
yeah news on this PR would be great |
I believe we've fixed it in PR: #1339 |
Closing this since we think it's fixed in PR #1339. If you still encounter this problem, please reopen. Thanks. |
This issue is still not fixed using version 3.12.0 of the datasource juggler. Upon using a query like this:
Loopback still productes the |
@daankets thank you for the comment, I am reopening this issue then. Would you like to contribute the fix yourself? |
I worked around this now inserting a boolean attribute using observe(“before save”). I didn’t have the time to look at this in-depth. But I might have a look next week.
With kind regards
Daan Kets
Managing Partner
Delta Source Belgium
…On 5 Oct 2017, 13:35 +0200, Miroslav Bajtoš ***@***.***>, wrote:
@daankets thank you for the comment, I am reopening this issue then. Would you like to contribute the fix yourself?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
--
*Disclaimer*
This message is *confidential* and only intended for the originally
intended recipient(s). It may also be privileged or otherwise protected by
work product immunity or other legal rules. *If you think you have received
this message by mistake*, please let us know by e-mail reply and delete it
from your system; you must not copy this message or disclose its contents
to anyone other than the intended recipients.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the |
@0candy This is still an issue today. If you are using MongoDB at least, you can not query using the exists operator on a date field.
|
@bajtos I am still experiencing this issue with MongoDB in Loopback 4 as well. Any updates on this in the last few years? |
I have declared a date field in the model:
and then tried to make a find with an or condition:
and i get following error:
Is this a bug in the validation?
The text was updated successfully, but these errors were encountered: