Giter VIP home page Giter VIP logo

Comments (3)

grzegorzbialy avatar grzegorzbialy commented on August 20, 2024 1

I stumbled upon same issue while trying to import dates.
Until the issue is solved you can use onCreate trigger to correct the date.

Eg.:

exports.onSlotCreate = functions
  .firestore.document('docs/{docId}')
  .onCreate(async (snapshot, context) => {
    const docData = snapshot.data();
    let update = false;

    if (typeof docData.date === "string") {
      docData.date = new Date(docData.date);
      update = true;
    }

    if (update) {
      db.collection('docs').doc(snapshot.id).update({date: docData.date});
    }
  });

from rowy.

mayurdhurpate avatar mayurdhurpate commented on August 20, 2024

@notsidney I think, all the fields are being imported as strings in the Firestore, and hence the Data Parser shows Something went wrong in the Date call.

I tried importing the following fields:

  • name : string
  • profilePictureUrl : string
  • rating : number
  • review : string
  • reviewId : string
  • timestamp : Date

with following csv:

name,profilePictureUrl,rating,review,reviewId,timestamp
Madhuri Salunkhe,,5,,temp_review,11/11/2020

Data Key Mapping Screen:

Screenshot 2020-10-08 at 7 59 21 PM

Firetable Post Import Screen

Screenshot 2020-10-08 at 7 59 54 PM

Actual Firestore Data Stored:

Screenshot 2020-10-08 at 8 00 08 PM

All the fields were directly added to Firestore as strings.

I think this could be the function which needs modification for type aware data importing.
https://github.com/AntlerVC/firetable/blob/fd036f59c7111b5105d69f94d183ccb1439eb0b7/www/src/components/Table/ImportCSV.tsx#L96-L105

from rowy.

notsidney avatar notsidney commented on August 20, 2024

Hi everyone, thanks for letting us know about this bug. I’m working on a new Import CSV wizard UI, which includes parsing date columns. We’ll be using date-fns’ parseJSON function, which supports a bunch of formats similar to the ISO date string format. Please note that it assumes your date is in UTC time, so if your CSV’s date is not in UTC and your browser/system’s timezone is not UTC, Firetable (and Firestore) will display a different date/time value (converted from UTC to your local timezone).

👉 So before using the Import CSV feature, you must convert dates to UTC time and a supported format.

When rows are added, it will store dates as Firestore Timestamps, similar to adding a new row & inputting a date through the picker.

The new Import CSV wizard will be available as part of the next PR from develop to master.

from rowy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.