Skip to content

Fix timestamps set with Invalid Date in some cases#1796

Merged
ricardograca merged 2 commits into
masterfrom
rg-fix-timestamps
Mar 23, 2018
Merged

Fix timestamps set with Invalid Date in some cases#1796
ricardograca merged 2 commits into
masterfrom
rg-fix-timestamps

Conversation

@ricardograca

Copy link
Copy Markdown
Member

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
@ricardograca
ricardograca deleted the rg-fix-timestamps branch March 23, 2018 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant