Implement a datePicker using javascript

I am trying to implement a date picker on a field , code is shown below but it does not work.

`
@Html.LabelFor(model => model.TimePeriod.EndDate, htmlAttributes: new { @class = “control-label col-md-8” })

@Html.EditorFor(model => model.TimePeriod.EndDate, new { htmlAttributes = new { @class = “datepicker form-control” } })
@Html.ValidationMessageFor(model => model.TimePeriod.EndDate, “”, new { @class = “text-danger” })

                <script type="text/javascript">
                    var currentTime = new Date()
                    var picker = new Pikaday(
                        {
                            field: document.getElementById('EndDate'),
                            firstDay: 1,
                            minDate: new Date('2010-01-01'),
                            maxDate: new Date('2033-12-12'),
                            yearRange: [2010, 2033],
                            numberOfMonths: 1,
                            theme: 'dark-theme'
                        });
                </script>
            </div>`