J
J
JhonnyB2018-12-24 16:37:22
JavaScript
JhonnyB, 2018-12-24 16:37:22

Select a number after a certain number of days from a given one?

Good afternoon.
I'm making a small app for mobile phones.
Task - a person sets the date and interval (For example: May 1, 20 days), you need to select the date that will be after the interval (In the previous example, May 1 was set and the interval is 20 days, May 21 will be selected accordingly).
For the calendar I use https://github.com/wix/react-native-calendars
Can you tell me how to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Alexandrovich, 2018-12-24
@RomReed

I think the add days function looks like this

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

and in the react-native-calendars component itself, try the current={'2012-03-01'} key to set your addDays function result

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question