How to use the d3-time.timeDay.floor function in d3-time

To help you get started, we’ve selected a few d3-time examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cityofasheville / simplicity2 / src / app / development / volume / TimeSlider.js View on Github external
);
  }
}

TimeSlider.propTypes = {
  // defaultBrushExtent: PropTypes.arrayOf(PropTypes.number),
  onBrushEnd: PropTypes.func,
  xSpan: PropTypes.number,
};

TimeSlider.defaultProps = {
  defaultBrushExtent: [
    timeWeek.offset(timeDay.floor(new Date()), -1).getTime(),
    timeDay.floor(new Date()).getTime(),
  ], // today and today minus thirty-one days
  onBrushEnd: newExtent => console.log(newExtent),
  xSpan: 2, // in years
};

export default TimeSlider;
github cityofasheville / simplicity2 / src / app / development / volume / TimeSlider.js View on Github external
/>}
        
      
    );
  }
}

TimeSlider.propTypes = {
  // defaultBrushExtent: PropTypes.arrayOf(PropTypes.number),
  onBrushEnd: PropTypes.func,
  xSpan: PropTypes.number,
};

TimeSlider.defaultProps = {
  defaultBrushExtent: [
    timeWeek.offset(timeDay.floor(new Date()), -1).getTime(),
    timeDay.floor(new Date()).getTime(),
  ], // today and today minus thirty-one days
  onBrushEnd: newExtent => console.log(newExtent),
  xSpan: 2, // in years
};

export default TimeSlider;
github orbiting / republik-frontend / components / Events / List.js View on Github external
title: event.title,
                  description: event.metaDescription,
                  url: `${PUBLIC_BASE_URL}/veranstaltung/${event.slug}`,
                  image: `${CDN_FRONTEND_BASE_URL}/static/social-media/logo.png`
                }}
              />
              
              
                <a>{t('events/all')}</a>
              
            
          
        )
      }

      const today = timeDay.floor(new Date())
      const upcoming = events
        .filter(event =&gt; today &lt;= event.__parsedDate)
        .sort((a, b) =&gt; ascending(a.__parsedDate, b.__parsedDate))
      const past = events
        .filter(event =&gt; today &gt; event.__parsedDate)
        .sort((a, b) =&gt; descending(a.__parsedDate, b.__parsedDate))

      return (
        
          <content>
            </content>
github cityofasheville / simplicity2 / src / app / development / permits / PermitsIndex.js View on Github external
constructor() {
    super();
    const now = timeDay.floor(new Date());
    this.initialBrushExtent = [
      timeWeek.offset(now, -4).getTime(),
      now.getTime(),
    ];
    this.state = {
      timeSpan: this.initialBrushExtent,
    };
  }
github orbiting / crowdfunding-frontend / components / Events / List.js View on Github external
<div>
          
          
          
            <a>{t('events/all')}</a>
          
        </div>
      )
    }

    const today = timeDay.floor(new Date())
    const upcoming = events.filter(event =&gt; {
      return today &lt;= parseDate(event.date)
    })
    const past = events.filter(event =&gt; {
      return today &gt; parseDate(event.date)
    })
    return (
      <div>
        
        {!!upcoming.length &amp;&amp; (
          <h3></h3></div>
github cityofasheville / simplicity2 / src / app / development / trc / TRCDataTable.js View on Github external
constructor() {
    super();
    const now = timeDay.floor(new Date());
    this.initialBrushExtent = [
      timeMonth.offset(now, -12).getTime(),
      now.getTime(),
    ];
    this.state = {
      timeSpan: this.initialBrushExtent,
    };
  }
github cityofasheville / simplicity2 / src / app / development / volume / TimeSlider.js View on Github external
function spanOfYears(numYears) {
  return [
    timeYear.offset(timeDay.floor(new Date()), -1 * numYears).getTime(),
    timeDay.floor(new Date()).getTime(),
  ];
}