-3

I am working on a project on MVC in which I have added date time picker in the form field for that I have downloaded bootstrap-datetimepicker.

I have extracted JS and CSS Files to my project but still, it shows some error.

The Error is:

VM199:2 Uncaught ReferenceError: moment is not defined
    at HTMLDocument.eval (eval at globalEval (jquery-2.1.4.js:328), <anonymous>:2:42)
    at fire (jquery-2.1.4.js:3099)
    at Object.add [as done] (jquery-2.1.4.js:3145)
    at jQuery.fn.init.jQuery.fn.ready (jquery-2.1.4.js:3378)
    at jQuery.fn.init (jquery-2.1.4.js:2821)
    at jQuery (jquery-2.1.4.js:76)
    at eval (eval at globalEval (jquery-2.1.4.js:328), <anonymous>:1:1)
    at eval (<anonymous>)
    at Function.globalEval (jquery-2.1.4.js:328)
    at jQuery.fn.init.domManip (jquery-2.1.4.js:5435)
ADreNaLiNe-DJ
  • 4,787
  • 3
  • 26
  • 35
Kovid Purohit
  • 258
  • 1
  • 4
  • 15

2 Answers2

0

For the Bootstrap datetimepicker to function correctly, the following set of files needed to added in the tag

> jQuery
> Moment.js
> Bootstrap.js (transition and collapse features are required if you're not using the full Bootstrap)
> Bootstrap Datepicker script
> Bootstrap CSS
> Bootstrap Datepicker CSS

Initialise the datetimepicker

  $("#fromDate").datetimepicker({
              sideBySide: true,
              debug:false,
              useCurrent: false,
              format: 'YYYY-MM-DD HH:mm:ss'
              }) 

<div class="input-group date" id="fromDate">
                    <input type="text" class="form-control" name="fromDate"/>
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>

DateTimepicker has lot of customisable features.To know more about it , refer to the DateTimePicker

jaggs
  • 298
  • 2
  • 9
  • 28
0

I have resolved my error it was due to duplicate function that was defined somewhere else in the code.

Kovid Purohit
  • 258
  • 1
  • 4
  • 15