Search code examples
javascripttwitter-bootstrapbootstrap-datetimepicker

How to use bootstrap datetimepicker locale option properly


I would like how to use bootstrap datetimepicker locale option properly.

Manual says

locale Default: moment.locale() Accepts: string, moment.local('locale') See momentjs for valid locales.

You must include moment-with-locales.js or a local js file.

I would like to include it.js.

I have got this HTML but it doesn't apply custom language.

<head runat="server">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/bootstrap-theme.min.css" rel="stylesheet" />
    <link href="~/Content/bootstrap-datetimepicker.min.css" rel="stylesheet" />


    <script src="/Scripts/jquery-1.9.1.min.js"></script>
    <%--<script src="/Scripts/moment-with-locales.min.js"></script>--%>
    <script src="/Scripts/moment.min.js"></script>
    <script src="/Scripts/bootstrap.min.js"></script>
    <script src="/Scripts/bootstrap-datetimepicker.min.js"></script>
    <script src="/Scripts/it.js"></script>

</head>

So what do I have to do?

Any clue?


Solution

  • I found a how to use it.

    $('.datepicker').datetimepicker({ locale: 'es' });