I am using momentjs.
I want to show a value if a date is between two date (and include those 2 dates)
following moment Documentation
moment('2019/09/02').isBetween(
'1900/01/01',
'2019/09/02',
'[]'
)
Why is this returning false ? it should return true as today is included in today.
I am using momentjs.
I want to show a value if a date is between two date (and include those 2 dates)
following moment Documentation
moment('2019/09/02').isBetween(
'1900/01/01',
'2019/09/02',
'[]'
)
Why is this returning false ? it should return true as today is included in today.
Share Improve this question edited Sep 2, 2019 at 9:12 Eddie 26.8k6 gold badges38 silver badges59 bronze badges asked Sep 2, 2019 at 9:11 CrocsxCrocsx 7,62015 gold badges86 silver badges176 bronze badges2 Answers
Reset to default 16Check again the doc.
The third param is the granularity and the fourth param is the interval.
so in your case, it should be
moment('2019/09/02').isBetween(
'1900/01/01',
'2019/09/02',
null, // can be year, month .... the granularity of your aprison
'[]'
)
Use this trick.
moment('2019/09/02).isBetween('1900/01/01', '2019/09/02 23:59:59');