grabury
grabury

Reputation: 5559

How to create start and end date from a year string

I want to get the start and end dates of a particular year.

Something like moment(2009).startOf('year') // Format: 2009-01-01 00:00 moment(2009).endOf('year') // Format: 2009-12-31 11:59

Upvotes: 0

Views: 41

Answers (1)

KingsthwaiteJ
KingsthwaiteJ

Reputation: 494

Try something like this:

const start = moment([2009]).startOf('year').format('YYYY-MM-DD HH:MM');
const end = moment([2009]).endOf('year').format('YYYY-MM-DD HH:MM');

Upvotes: 1

Related Questions