How to use the d3-time.timeDay.count 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 d3 / d3-time-format / src / locale.js View on Github external
function formatDayOfYear(d, p) {
  return pad(1 + timeDay.count(timeYear(d), d), p, 3);
}
github orbiting / republik-frontend / components / Frame / ProlongBox.js View on Github external
t,
  prolongBeforeDate,
  router,
  inNativeApp,
  inNativeIOSApp,
  dark: inDarkFrame
}) => {
  if (
    router.pathname === '/pledge' ||
    router.pathname === '/cancel' ||
    router.pathname === '/meta'
  ) {
    return null
  }
  const date = new Date(prolongBeforeDate)
  const numberOfDays = timeDay.count(new Date(), date)
  if (numberOfDays <= 30) {
    const key =
      numberOfDays <= 2 ? (numberOfDays < 0 ? 'overdue' : 'due') : 'before'
    const baseKey = `prolongNecessary/${key}`

    const dark = inDarkFrame || key !== 'before'
    const colorStyle = { color: dark ? '#fff' : undefined }

    const explanation = t.elements(
      `${baseKey}/explanation`,
      {
        cancelLink: (
          
            
              {t(`${baseKey}/explanation/cancelText`)}
github orbiting / republik-frontend / components / Pledge / CustomizePackage.js View on Github external
(days, period) =>
                days +
                timeDay.count(
                  new Date(period.beginDate),
                  new Date(period.endDate)
                ),
              0
github orbiting / republik-frontend / components / Pledge / CustomizePackage.js View on Github external
.map(period => {
                          const beginDate = new Date(period.beginDate)
                          const endDate = new Date(period.endDate)
                          const formattedEndDate = dayFormat(endDate)
                          const days = timeDay.count(beginDate, endDate)

                          const title = t.first(
                            [
                              `option/${pkg.name}/additionalPeriods/${period.kind}/title`,
                              `option/${pkg.name}/additionalPeriods/title`
                            ],
                            {
                              formattedEndDate,
                              days
                            }
                          )
                          const explanation = t.first(
                            [
                              `option/${pkg.name}/additionalPeriods/${period.kind}/explanation`,
                              `option/${pkg.name}/additionalPeriods/explanation`
                            ],