Change stats date to be by Pacific time zone
This commit is contained in:
parent
a2b01e28c9
commit
b4244ea75d
|
@ -1,5 +1,11 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
import * as dayjs from 'dayjs'
|
||||
import * as utc from 'dayjs/plugin/utc'
|
||||
import * as timezone from 'dayjs/plugin/timezone'
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
import { concat, countBy, sortBy, range, zip, uniq, sum, sumBy } from 'lodash'
|
||||
import { getValues, log, logMemory } from './utils'
|
||||
import { Bet } from '../../common/bet'
|
||||
|
@ -103,7 +109,7 @@ export async function getDailyNewUsers(
|
|||
}
|
||||
|
||||
export const updateStatsCore = async () => {
|
||||
const today = Date.now()
|
||||
const today = dayjs().tz('America/Pacific').startOf('day').valueOf()
|
||||
const startDate = today - numberOfDays * DAY_MS
|
||||
|
||||
log('Fetching data for stats update...')
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import dayjs from 'dayjs'
|
||||
import { useEffect, useState } from 'react'
|
||||
import {
|
||||
DailyCountChart,
|
||||
|
@ -49,6 +48,7 @@ export default function Analytics() {
|
|||
|
||||
export function CustomAnalytics(props: Stats) {
|
||||
const {
|
||||
startDate,
|
||||
d1,
|
||||
d1Weekly,
|
||||
w1NewUsers,
|
||||
|
@ -66,8 +66,6 @@ export function CustomAnalytics(props: Stats) {
|
|||
manaBet,
|
||||
} = props
|
||||
|
||||
const startDate = dayjs(props.startDate).add(12, 'hours').valueOf()
|
||||
|
||||
const dailyDividedByWeekly = dailyActiveUsers
|
||||
.map((dailyActive, i) =>
|
||||
Math.round((100 * dailyActive) / weeklyActiveUsers[i])
|
||||
|
|
Loading…
Reference in New Issue
Block a user