diff --git a/dist/app.bundle.js b/dist/app.bundle.js index d2b6e02..2079441 100644 --- a/dist/app.bundle.js +++ b/dist/app.bundle.js @@ -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; }); diff --git a/src/js/app.jsx b/src/js/app.jsx index a3451fc..d0687dd 100644 --- a/src/js/app.jsx +++ b/src/js/app.jsx @@ -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; });