Skip to content

Commit

Permalink
Fix dates.
Browse files Browse the repository at this point in the history
  • Loading branch information
metasyn authored and Alexander Johnson committed Mar 14, 2019
1 parent 108a173 commit 05544ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
15 changes: 10 additions & 5 deletions dist/app.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29000,13 +29000,18 @@ var Application = function (_Component) {
value: function filterDate(newDate) {
var dates = this.state.dates;

// Seriously, fuck javascript so much

function pad(n) {
return n < 10 ? '0' + n : n;
}

var dateString = newDate.getFullYear() + '-' + pad(newDate.getMonth() + 1) + '-' + pad(newDate.getDate());
// Loop over all the dates and compare them to a specifc date we've been given
// this is highly dependent on the way we've chosen to format the date
var newDates = _lodash2.default.map(dates, function (dateObj) {
var someday = newDate.toString().slice(0, 10);
var somedayList = someday.split(' ');
somedayList[2] = String(parseInt(somedayList[2], 10));
var date = somedayList.join(' ');
dateObj.checked = dateObj.date === date;
debugger;
dateObj.checked = dateObj.date === dateString;
return dateObj;
});

Expand Down
14 changes: 9 additions & 5 deletions src/js/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,16 @@ class Application extends Component {
filterDate(newDate) {
const { dates } = this.state;

// Seriously, fuck javascript so much
// what the serious fuck is wrong with this language
// this is the most garbage language JFC
function pad(n){return n<10 ? '0'+n : n}
const dateString = `${newDate.getFullYear()}-${pad(newDate.getMonth()+1)}-${pad(newDate.getDate())}`

// Loop over all the dates and compare them to a specifc date we've been given
// this is highly dependent on the way we've chosen to format the date
const newDates = _.map(dates, (dateObj) => {
const someday = newDate.toString().slice(0, 10);
const somedayList = someday.split(' ');
somedayList[2] = String(parseInt(somedayList[2], 10));
const date = somedayList.join(' ');
dateObj.checked = dateObj.date === date;
dateObj.checked = dateObj.date === dateString;
return dateObj;
});

Expand Down

0 comments on commit 05544ce

Please sign in to comment.