V
V
Valery Orlov2018-10-26 15:15:24
JavaScript
Valery Orlov, 2018-10-26 15:15:24

How to correctly organize the trial period of the application?

Good day to all.
I am planning a trial period for processing incoming data in a Node.JS application.
Essentially, the user registers. Then, in your personal account, you can add a list of mobile devices, with a cat. requests will be processed. The thought came to mind when in b.d. all information about the device is recorded, add a field to the cat. the lock date will be stored. Those. today's date + 3 days. Now, with each request, it will check if this date has come, if so, offer to extend the maintenance period.
Hence the question: How can I get such a date?
Perhaps my logic is ridiculous and I would consider any suggestions.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dollar, 2018-10-26
@dollar

It is better to make the trial period eternal, but with limited functionality.

E
Eugene, 2018-10-26
@EShein

I think it will be easier to write the date + 3 days and check today's date with the date in the database 
. How to get the date?

let date = new Date();
date.setDate(date.getDate() + 3);

Or the moment library.

S
shmatuan, 2018-10-26
@shmatuan

Hence the question: How can I get such a date?

function addDays(date, days) {
  var result = new Date(date);
  result.setDate(result.getDate() + days);
  return result;
}

addDays(new Date(), 3)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question