8

पर शुरू होता है मेरे एमवीसी 5 प्रोजेक्ट में बूटस्ट्रैप 3 डेटीमिपिकर 3.0.0 https://www.nuget.org/packages/Bootstrap.v3.Datetimepicker/ का उपयोग करने के कुछ कारण हैं।बूटस्ट्रैप 3 डेटीमेपिकर 3.0.0 - सप्ताह सोमवार

कोई विचार सप्ताह के शुरू होने का तरीका शुरू होता है, इसलिए यह सोमवार से शुरू होता है। भाषा टैग भी काम नहीं कर रहा है।

$(function() { 
    $('#PickupTime').datetimepicker({ 
    weekStart: 1 
    }); 
}); 

यह काम नहीं कर रहा है क्योंकि यह एक ही बूटस्ट्रैप-datapicker.js

उत्तर

3

moment.js का उपयोग करने के बजाय मैंने क्षण-साथ-langs.js का उपयोग किया (मुझे लगता है कि यह डिफ़ॉल्ट पैकेज एएसपी.नेट एमवीसी 5 के साथ आया था)।

बुला द्वारा:

<script type="text/javascript"> 
    $('#DateTime').datetimepicker({ 
     language: "hr" 
    }); 
</script> 

बात काम करता है, अंत में कैलेंडर सोमवार से शुरू होता है।

अद्यतन: और भी बेहतर, जोड़ने कुंजी web.config को

<appSettings>  
    <add key="Culture" value="hr" /> 
</appSettings> 

और फिर

$(document).ready(function() { 
    $(document).on('focus', '#Date', function() { 
     $(this).datetimepicker({ 
      locale: '@System.Configuration.ConfigurationManager.AppSettings["Culture"]', 
      format: 'DD:MM:YYYY', 
     }); 
    }); 
}); 
4

DateTimePicker के लिए विकल्प यह संभव नहीं है के अनुसार नहीं है। यह केवल निम्नलिखित गुण का समर्थन करता है:

$.fn.datetimepicker.defaults = { 
    pickDate: true,     //en/disables the date picker 
    pickTime: true,     //en/disables the time picker 
    useMinutes: true,    //en/disables the minutes picker 
    useSeconds: true,    //en/disables the seconds picker 
    useCurrent: true,    //when true, picker will set the value to the current date/time  
    minuteStepping:1,    //set the minute stepping 
    minDate:`1/1/1900`,    //set a minimum date 
    maxDate: ,  //set a maximum date (defaults to today +100 years) 
    showToday: true,     //shows the today indicator 
    language:'en',     //sets language locale 
    defaultDate:"",     //sets a default date, accepts js dates, strings and moment objects 
    disabledDates:[],    //an array of dates that cannot be selected 
    enabledDates:[],    //an array of dates that can be selected 
    icons = { 
     time: 'glyphicon glyphicon-time', 
     date: 'glyphicon glyphicon-calendar', 
     up: 'glyphicon glyphicon-chevron-up', 
     down: 'glyphicon glyphicon-chevron-down' 
    } 
    useStrict: false,    //use "strict" when validating dates 
    sideBySide: false,    //show the date and time picker side by side 
    daysOfWeekDisabled:[]   //for example use daysOfWeekDisabled: [0,6] to disable weekends 
}; 

Source: http://eonasdan.github.io/bootstrap-datetimepicker/#options

आप सप्ताह के अंत को निष्क्रिय करता है, तो आप रविवार को देखने के लिए नहीं करना चाहते हैं कर सकते हैं।

+0

पर कॉल करते समय लोकेल के माध्यम से डॉव वैल्यू को ओवरराइड भी कर सकते हैं लेकिन अभी भी बाएँ स्तंभ रविवार है, और लोगों को सोमवार – HerGiz

+0

उम्मीद बूटस्ट्रैप-datapicker.js में मैं नाम offseted है, लेकिन केवल नाम mooved जाते हैं, न दिनांकों ही है, इसलिए पूरे कैलेंडर सही नहीं है। Eaven treid moment.js में बदल रहा है, लेकिन एक ही बात है। – HerGiz

+0

कोई प्रतिस्थापन परेशानी? – HerGiz

-1

खुला jquery.datetimepicker.js और पाते हैं चर "dayOfWeekStart" और इसे पर सेट करें 1

+2

ओपी [Eonasdan बूटस्ट्रैप-Datepicker] (http://eonasdan.github.io/bootstrap-datetimepicker/) की चर्चा करते हुए किया गया था। इसका jQuery की डेटपिकर से कोई लेना देना नहीं है। –

+0

कुछ भी नहीं ओपी के सवाल के साथ क्या करना। – FrenkyB

4

मैंने अभी किया है! पल.जेएस में इस लाइन को बदलें:

_week : { 
    dow : 1, // Sunday is the first day of the week. 
    doy : 6 // The week that contains Jan 1st is the first week of the year. 
}, 

'डॉव' होना चाहिए 1 और सप्ताह सोमवार को शुरू होता है।

23

यदि आप v2.8.1 से moment.js का उपयोग कर रहे हैं, तो datetimepicker() को कॉल करने से पहले नीचे कोड जोड़ें।

moment.updateLocale('en', { 
    week: { dow: 1 } // Monday is the first day of the week 
}); 

$('#DateTime').datetimepicker(); 

आप moment.js के पुराने संस्करण का उपयोग कर रहे हैं, तो निम्न

moment.lang('en', { 
    week: { dow: 1 } 
}); 

$('#DateTime').datetimepicker(); 
0

कर मैं एक ही सवाल पर ठोकर खाई है, और मैं उपयोग कर रहा हूँ:

और, user3928861 के उत्तर के बाद मुझे पल के लाइन 961 पर उत्तर मिला।js इस प्रकार है:

आप मैन्युअल रूप से यह

$('#DateTime').datetimepicker({ 
    locale: moment.local('en') 
}); 
0

DateTimePicker मैच के लिए भी आप दुनिया में हैं (स्थान विकल्प http://eonasdan.github.io/bootstrap-datetimepicker/Options/#locale देखें) स्थापित करने के लिए है कि एक विकल्प होता है डेटाेटिमपिकर()

$('#myid').datetimepicker({ 
    format:'YYYY-MM-DD', 
    locale: moment.locale('en', { 
     week: { dow: 1 } 
    }), 
}); 
0

आप ओवरराइड कर सकते हैं

var defaultLocaleWeek = { 
    dow : 1, // Sunday is the first day of the week. 
    doy : 6 // The week that contains Jan 1st is the first week of the year. 
}; 
संबंधित मुद्दे