Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
How to increase the current Timestamp to next month in cloud functions?

I am working with cloud functions. Initially, I am extracting data from a collection and then I have to add the same data to another document but I want to change to the timestamp to next month. Example - Old timestamp - 24 February 2022 at 03:00:00 UTC+5:30 The timestamp I want to add to a new collection - 24 March 2022 at 03:00:00 UTC+5:30 My code -

    /* eslint-disable */
    const functions = require("firebase-functions");
    const admin = require('firebase-admin');
    admin.initializeApp();
    const database = admin.firestore();

    exports.checkForPending = functions.pubsub.schedule('* * * * *').onRun(async 
      (context) => {
        const query = 
        database.collection("users").doc('IELTS').collection('IELTS').where("next", '<=', admin.firestore.Timestamp.now());
        const snapshot = await query.get();
        snapshot.forEach(doc => {
          console.log(doc.id, '=>', doc.data().name);
          database.collection('pending').add(doc.data()); 
        });

       return null;
     });    

Thank you in advance!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!