Skip to content

Commit 53ea852

Browse files
committed
Filters out shifts with invalid dates
1 parent a16e42f commit 53ea852

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/client/src/pages/DataView360/View/components/VolunteerHistory.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ const SHIFTS_TO_SHOW = 3;
3030
class VolunteerHistory extends Component {
3131

3232
createShiftRows(shifts) {
33-
const shiftsSorted = _.sortBy(shifts, shift => {
34-
return new moment(shift.from);
33+
const shiftsFiltered = _.filter(shifts, function(s) { return s.from !== "Invalid date"});
34+
const shiftsSorted = _.sortBy(shiftsFiltered, shift => {
35+
return new moment(shift.from).format("YYYY-MM-DD");
3536
}).reverse();
3637

3738
const lastShifts = shiftsSorted.slice(0, SHIFTS_TO_SHOW)
39+
3840
const result = _.map(lastShifts, (shift, index) => {
39-
shift.from = (shift.from === "Invalid date") ? "Unknown" : moment(shift.from).format("MM-DD-YYYY")
41+
shift.from = moment(shift.from).format("YYYY-MM-DD")
4042
return(<TableRow key={index}>
4143
<TableCell>{shift.from}</TableCell>
4244
<TableCell>{shift.assignment}</TableCell>

0 commit comments

Comments
 (0)