Submitting data for today versus what used to be today

This is a #uvi nitpick that keeps biting me.

When you leave a goal page open overnight and then go to submit data, you end up submitting data for yesterday. I wouldn’t call this a bug, but if you look at the text it says Today (30). The big non-parentheses text says I’m submitting data for Today but in fact I’m submitting data for whatever dat it used to be (the date in parentheses) regardless of what day today is. IMHO it should either figure out what day it is when I hit submit or it should read August 30 (Today).

For reference here is what it looks like:


On the flip side, I really like that the date picker seems to be smart enough to know that if the arbitrary deadline is after midnight but hasn’t passed yet, stay within “arbitrary deadline” today (which looks like yesterday).

This is so refreshing as compared to BeemiOS, which doesn’t follow this behavior, and has tripped me up on countless frantic eep days. (and BeemiOS has no edit or undo)

Not sure if these are conflicting cases, or as you say it’s simply a problem a with stale data from leaving the page open too long. If so, adding this to the page should make it check once every 30 minutes and update if necessary:

function updateNewDataDateDropdowns() {
  function pad(monthOrDate) {
    return monthOrDate < 10 ? '0' + monthOrDate : monthOrDate
  var now = new Date
  var nowAsBmndrDate = now.getFullYear() + '-' + pad(now.getMonth() + 1) + '-' + pad(now.getDate())

  if ($('').attr('data-value') !== nowAsBmndrDate) {
    var yesterday = $('').attr('data-value')
    $('').attr('data-value', nowAsBmndrDate)
    $('').text('Today (' + nowAsBmndrDate.split('-')[2] + ')')
    $('.day.yesterday').attr('data-value', yesterday)
    $('.day.yesterday').text('Yesterday (' + yesterday.split('-')[2] + ')')

setInterval(updateNewDataDateDropdowns, 30 * 60 * 1000 /* 30 minutes */ )

The page should be able to calculate at load time how long it needs to wait until it updates without resorting to polling.


For sure