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

Conversation

Projects
None yet
1 participant
@ricardograca
Member

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.

ricardograca added some commits Mar 23, 2018

Check if timestamp has valid value before casting
- 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 from Rg fix timestamps to 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

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