Created
April 29, 2022 20:00
-
-
Save jkeefe/5c4ae5d8b83f43a47a9ac474b034e20d to your computer and use it in GitHub Desktop.
Test to see if a date is the last day of the month with dayjs()
This file contains hidden or 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
const dayjs = require('dayjs') | |
const customParseFormat = require('dayjs/plugin/customParseFormat') | |
dayjs.extend(customParseFormat) | |
const reading_date = dayjs(reading.t, 'M/D/YYYY HH:mm:ss A') | |
// is the month of adding a day the same as the month of adding a month? | |
if ( reading_date.add(1, 'day').get('month') == reading_date.add(1, 'month').get('month') ){ | |
console.log(reading.t) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment