Skip to content

Commit 161a06a

Browse files
rihadavidflovilmart
authored andcommitted
Updating array of Dates no longer converts it to array of strings (#770)
* Added explicit Date __Type field to Dates in Arrays * Update CHANGELOG.md * Reformatted to avoid nested ternary operators
1 parent 67d3c97 commit 161a06a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### NEXT RELEASE
44

55
* _Contributing to this repo? Add info about your change here to be included in next release_
6+
* Fix: Updating array of Dates now keeps it's type (was changing to array of ISO strings, issue #590), thanks to [David Riha](https://github.com/rihadavid)
67
* Fix: NaN displayed when filter input is empty or negative number (#749), thanks to [Miguel Serrrano](https://github.com/miguel-s)
78
* Fix: Addresses issue related to displaying iOS alert object containing title and body keys (#539), thanks to [Robert Martin del Campo](https://github.com/repertus)
89

src/dashboard/Data/Browser/BrowserTable.react.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,15 @@ export default class BrowserTable extends React.Component {
201201
value = '';
202202
} else if (type === 'Array') {
203203
if (value) {
204-
value = value.map(val => val instanceof Parse.Object ? val.toPointer() : val);
204+
value = value.map(val => {
205+
if (val instanceof Parse.Object) {
206+
return val.toPointer();
207+
} else if (typeof val.getMonth === 'function') {
208+
return { __type: "Date", iso: val.toISOString() };
209+
}
210+
211+
return val;
212+
});
205213
}
206214
}
207215
let wrapTop = Math.max(0, this.props.current.row * ROW_HEIGHT);

0 commit comments

Comments
 (0)