Skip to content

[Firestore] Timestamp.fromDate(date) broken #1793

Closed

Description

@fabienpatou
  • Operating System version: N/A
  • Firebase (admin) SDK version: 11.0.0
  • Firebase Product: Firestore
  • Node.js version: 16
  • NPM version: 8.9.0

Timestamp.fromDate(date) is broken with following error:

TypeError: Cannot read properties of undefined (reading 'fromDate')
at dateToTimestamp (/Users/fabienpatou/dev/plato-backend-firebase/functions/lib/utils/utils.js:129:61)
at /Users/fabienpatou/dev/plato-backend-firebase/functions/lib/B2BFunctions/Agenda/rejectCall.js:67:52
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /Users/fabienpatou/dev/plato-backend-firebase/functions/node_modules/firebase-functions/lib/common/providers/https.js:407:26
at async runFunction (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:564:9)
at async runHTTPS (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:590:5)
at async handler (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:510:17)

Activity

  1. google-oss-bot commented on Jul 4, 2022

    @google-oss-bot

    I found a few problems with this issue:

    • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
    • This issue does not seem to follow the issue template. Make sure you provide all the required information.
  2. lahirumaramba commented on Jul 5, 2022

    @lahirumaramba
    Member

    Hey @fabienpatou you might want to import the Timestamp type from Firestore. Could you try adding import { Timestamp } from 'firebase-admin/firestore';? Thanks.

  3. fabienpatou commented on Jul 6, 2022

    @fabienpatou
    Author

    Thanks @lahirumaramba, it's working !

    The following is not working:
    import * as admin from "firebase-admin"; admin.firestore.Timestamp.fromDate(date);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions