capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.

Home Page:https://capawesome.io/plugins/firebase/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Troubleshooting Date-Time Query Issues

SureshKumarToverto opened this issue · comments

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Version

Latest

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

Got empty array

  • userList = []

Expected behavior

We array of value

 userList = [{"LoggedinAt":"Timestamp(seconds=1675166136, nanoseconds=561000000)","DisplayName":"Test","CreatedOn":"Timestamp(seconds=1701674105, nanoseconds=723000000)"}]

Reproduction

https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/firestore

Steps to reproduce

public GetAllCheckInUser(filterData): any {
    var date =  moment(new Date()).subtract(1, 'h').toDate();
    console.log('date',date);    
    return from(FirebaseFirestore.getCollection({
      reference: 'LoggedinUser',
      compositeFilter: {
        type: 'and',
        queryConstraints: [         
          {
            type: 'where',
            fieldPath: 'LoggedinAt',
            opStr: '>',
            value: date,
          },
        ],
      },
    }))
      .pipe(
        map((actions) => actions.snapshots.map(a => {    
          const data = a.data as any;
          const id = a.id;
          return { id, ...data };
        })),
        map((data: any) => {
          return _.filter(data, (item) => item.AccountNumber !== null);
        })
      );
  }

Other information

FYI : In Firebase we have value like

image

Capacitor doctor

ionic cap build android --prod

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.

Which plugin version do you use?

I close this issue as duplicate of #474.