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