Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/components/bulk-entry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default Vue.extend({

reader.onload = () => {
if (reader.result) {
let strs = (reader.result as string).split('\n');
let strs = (reader.result as string).split('\n').filter(str => str !== '');

// Map of property key to possible columns
const columnDict: KeyAccessor = {
Expand Down Expand Up @@ -224,12 +224,10 @@ export default Vue.extend({
});

// if date picker is filled use it, otherwise most recent time
const lastTime = Math.max.apply(
Math,
parsedReadings.map((o: any) => {
return o.time;
})
);
const lastTime = parsedReadings.reduce((dateA: IDataEntryState, dateB: IDataEntryState) =>
moment(dateA.time).unix() > moment(dateB.time).unix() ? dateA : dateB
).time;
console.log(lastTime);
this.goal_time = this.goal_time ? moment(this.goal_time).format('MM/DD/YYYY') : lastTime;

// Set the readings
Expand Down