以前做項目的時候都沒有沉下心來學習,只是為了做出來而做,最近因為需要和心態的改變,所以看了一些js架構,自己對js有了較深的認識。
以後會將官方的庫修改,自己開發的東西做一個整理,以備將來項目重複利用。
找到jquery.ui.datepicker.js和jquery.ui.datepicker-zh-CN.js
將jquery.ui.datepicker.js內容
this.regional[''] = { // Default regional settingscloseText: 'Done', // Display text for close linkprevText: 'Prev', // Display text for previous month linknextText: 'Next', // Display text for next month linkcurrentText: 'Today', // Display text for current month linkmonthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'], // Names of months for drop-down and formattingmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formattingdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formattingdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formattingdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at SundayweekHeader: 'Wk', // Column header for week of the yeardateFormat: 'yyyymmdd', // See format options on parseDatefirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...isRTL: false, // True if right-to-left language, false if left-to-rightshowMonthAfterYear: false, // True if the year select precedes month, false for month then yearyearSuffix: '' // Additional text to append to the year in the month headers};
替換為jquery.ui.datepicker-zh-CN.js中的
this.regional['zh-CN'] = {closeText: '關閉',prevText: '<上月',nextText: '下月>',currentText: '今天',monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],monthNamesShort: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],dayNamesMin: ['日','一','二','三','四','五','六'],weekHeader: '周',dateFormat: 'yy-mm-dd',firstDay: 1,isRTL: false,showMonthAfterYear: true,yearSuffix: '年'};
並修改
$.extend(this._defaults, this.regional['zh-CN']);