firebase / firebase/firebase-js-sdk

firebase/database `serverTimestamp()` returns future time

Open
#9,370 3 comments 0 reactions 0 assignees View on GitHub
api: database needs-attention question stack:Vue
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

Windows 11

### Environment (if applicable)

Chrome 142

### Firebase SDK Version

12.4.0

### Firebase SDK Product(s)

Database

### Project Tooling

Vue app w/ Vite

### Detailed Problem Description

We have two projects (dev/prd)

and `serverTimestamp()` records:

- correct time in dev project
- INCORRECT time in prd project (about 1 minute ahead)

`.info/serverTimeOffset` returns:

- small value in dev project
- large value (over 70000) in prd project

Is there a way to fix this large time offset? or shouldn't I trust firebase server timestamp?

### Steps and code to reproduce issue

https://gist.github.com/mmyoji/9475c30446cf5779bd9fae1a5f2eb5a0

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked reproduction gist and the Realtime Database behavior around serverTimestamp() and .info/serverTimeOffset. Compare the dev and production project conditions described in the issue and establish a reproducible test; done means determining whether the SDK produces the incorrect value or the production project's reported offset explains it.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, typescript
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.