Get the first day of the current year using Moment.js

jquery, momentjs, typescript

Solution

var thisYear = (new Date()).getFullYear();    
var start = new Date("1/1/" + thisYear);
var defaultStart = moment(start.valueOf());

Problem

I have two input fields to search between dates. I want the start date to default to the first day of the current year and the end date to default to today. I have the end date but I am unsure of how to get it to display the start. ``` var defaultStart = var defaultEnd = moment((new Date()).valueOf()); $('#searchStart').val(defaultStart.format('DD/MM/YYYY')); $('#searchEnd').val(defaultEnd.format('DD/MM/YYYY')); ```

Original source