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

Fix timestamps set with Invalid Date in some cases #1796

Merged
merged 2 commits into from Mar 23, 2018
Merged

Conversation

@ricardograca
Copy link
Member

@ricardograca ricardograca commented Mar 23, 2018

Introduction

The previous PR introduced a bug that led to the timestamp attributes sometimes being set with a Invalid Date value.

This only happened if a model with hasTimestamps set to true or an array was being fetched but the associated timestamp columns were omitted in the fetch call using the columns: [ ... ] option.

Strangely this also affected all calls of fetchPage causing null or missing values for rowCount and pageCount.

Proposed solution

This just checks if the relevant timestamp attributes return a truthy value before attempting to cast them to a Date object.

- This fixes the issue of timestamp attributes being set to Invalid
Date if the associated columns were ommitted in a fetch call.
@ricardograca ricardograca changed the title Rg fix timestamps Fix timestamps set with Invalid Date in some cases Mar 23, 2018
@ricardograca ricardograca merged commit fac27fd into master Mar 23, 2018
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ricardograca ricardograca deleted the rg-fix-timestamps branch Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant