Problem with dates :(

Hi guys

I know my topic may be funny but I’m realy need helps to get some controls with dates,

For example
I have variable with date 25/7/2017
I want to return true if today date less than var date & var date not bigger than today date + 3 days.

I mean I want to know how can I get today date and compare it with other dates, or get the date of 3 days after today date

Please help me if u know the answer

MomentJs is what you are looking for. :wink:

1 Like

I would highly recommend date-fns over momentjs. Date-fns works with tree shaking and will result in a smaller bundle size.


This comment by creator of date-fns talks about strengths and weaknesses of each. Short version: unless you need a timezone function, date-fns is better right now. If you need fancy timezones, momentjs is the way to go.