Created
March 5, 2020 06:39
-
-
Save manishprajapatidev/2f831d58ba0d1226b6a747bd4e241317 to your computer and use it in GitHub Desktop.
Check Current Date is between start date and end date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var start_date = 'YOUR_START_DATE'; | |
var end_date = 'YOUR_END_DATE'; | |
var today = moment().local().format("YYYY-MM-DD"); | |
var start_date_to_match = moment(start_date).local().format("YYYY-MM-DD"); | |
var end_date_to_match = moment(end_date).local().format("YYYY-MM-DD"); | |
if (moment(today).isBetween(start_date_to_match, end_date_to_match, null, '[]')) { | |
console.log('Current Date is between start and end date'); | |
} else { | |
console.log('Sorry!! Current Date is not between start and end date'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment