How to use the @react-native-firebase/app/lib/common.isDate function in @react-native-firebase/app

To help you get started, we’ve selected a few @react-native-firebase/app 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 invertase / react-native-firebase / packages / firestore / lib / utils / serialize.js View on Github external
if (isArray(value)) {
    return getTypeMapInt('array', buildNativeArray(value));
  }

  if (isObject(value)) {
    if (value instanceof FirestoreDocumentReference) {
      return getTypeMapInt('reference', value.path);
    }

    if (value instanceof FirestoreGeoPoint) {
      return getTypeMapInt('geopoint', [value.latitude, value.longitude]);
    }

    // Handle Date objects are Timestamps as per web sdk
    if (isDate(value)) {
      const timestamp = FirestoreTimestamp.fromDate(value);
      return getTypeMapInt('timestamp', [timestamp.seconds, timestamp.nanoseconds]);
    }

    if (value instanceof FirestoreTimestamp) {
      return getTypeMapInt('timestamp', [value.seconds, value.nanoseconds]);
    }

    if (value instanceof FirestoreBlob) {
      return getTypeMapInt('blob', value.toBase64());
    }

    if (value instanceof FirestoreFieldValue) {
      return getTypeMapInt('fieldvalue', [value._type, value._elements]);
    }
github invertase / react-native-firebase / packages / firestore / lib / FirestoreTimestamp.js View on Github external
static fromDate(date) {
    if (!isDate(date)) {
      throw new Error(
        "firebase.firestore.Timestamp.fromDate(*) 'date' expected a valid Date object.",
      );
    }

    return FirestoreTimestamp.fromMillis(date.getTime());
  }

@react-native-firebase/app

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

Apache-2.0
Latest version published 27 days ago

Package Health Score

98 / 100
Full package analysis