├── .babelrc ├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .stylelintrc ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── composer.json ├── dist ├── datepicker.common.js ├── datepicker.css ├── datepicker.esm.js ├── datepicker.js ├── datepicker.min.css └── datepicker.min.js ├── docs ├── css │ ├── datepicker.css │ └── main.css ├── examples │ ├── date-range.html │ └── datepicker-in-modal.html ├── index.html └── js │ ├── datepicker.ar-AE.js │ ├── datepicker.ar-IQ.js │ ├── datepicker.ca-ES.js │ ├── datepicker.cs-CZ.js │ ├── datepicker.da-DK.js │ ├── datepicker.de-AT.js │ ├── datepicker.de-DE.js │ ├── datepicker.el-GR.js │ ├── datepicker.en-GB.js │ ├── datepicker.en-US.js │ ├── datepicker.es-ES.js │ ├── datepicker.fi-FI.js │ ├── datepicker.fr-FR.js │ ├── datepicker.hu-HU.js │ ├── datepicker.is-IS.js │ ├── datepicker.it-IT.js │ ├── datepicker.ja-JP.js │ ├── datepicker.js │ ├── datepicker.km-KH.js │ ├── datepicker.ko-KR.js │ ├── datepicker.lt-LT.js │ ├── datepicker.lv-LV.js │ ├── datepicker.nb-NO.js │ ├── datepicker.nl-NL.js │ ├── datepicker.oc-FR.js │ ├── datepicker.pl-PL.js │ ├── datepicker.pt-BR.js │ ├── datepicker.ro-RO.js │ ├── datepicker.ru-RU.js │ ├── datepicker.si-LK.js │ ├── datepicker.sk-SK.js │ ├── datepicker.sl-SI.js │ ├── datepicker.sv-SE.js │ ├── datepicker.ta-TA.js │ ├── datepicker.th-TH.js │ ├── datepicker.tr-TR.js │ ├── datepicker.ug-CN.js │ ├── datepicker.uk-UA.js │ ├── datepicker.vi-VN.js │ ├── datepicker.zh-CN.js │ └── main.js ├── i18n ├── datepicker.ar-AE.js ├── datepicker.ar-IQ.js ├── datepicker.ca-ES.js ├── datepicker.cs-CZ.js ├── datepicker.da-DK.js ├── datepicker.de-AT.js ├── datepicker.de-DE.js ├── datepicker.el-GR.js ├── datepicker.en-GB.js ├── datepicker.en-US.js ├── datepicker.es-ES.js ├── datepicker.fi-FI.js ├── datepicker.fr-FR.js ├── datepicker.he-IL.js ├── datepicker.hu-HU.js ├── datepicker.is-IS.js ├── datepicker.it-IT.js ├── datepicker.ja-JP.js ├── datepicker.km-KH.js ├── datepicker.ko-KR.js ├── datepicker.lt-LT.js ├── datepicker.lv-LV.js ├── datepicker.nb-NO.js ├── datepicker.nl-NL.js ├── datepicker.oc-FR.js ├── datepicker.pl-PL.js ├── datepicker.pt-BR.js ├── datepicker.ro-RO.js ├── datepicker.ru-RU.js ├── datepicker.si-LK.js ├── datepicker.sk-SK.js ├── datepicker.sl-SI.js ├── datepicker.sv-SE.js ├── datepicker.ta-TA.js ├── datepicker.th-TH.js ├── datepicker.tr-TR.js ├── datepicker.ug-CN.js ├── datepicker.uk-UA.js ├── datepicker.vi-VN.js └── datepicker.zh-CN.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── rollup.config.js ├── src ├── css │ ├── datepicker.css │ └── datepicker.scss ├── index.css ├── index.js ├── index.scss └── js │ ├── constants.js │ ├── datepicker.js │ ├── defaults.js │ ├── handlers.js │ ├── index.js │ ├── methods.js │ ├── render.js │ └── utilities.js └── test ├── css └── main.css ├── events ├── hide.js ├── pick.js └── show.js ├── index.html ├── js └── main.js ├── methods ├── destroy.js ├── formatDate.js ├── getDate.js ├── getDayName.js ├── getMonthName.js ├── hide.js ├── parseDate.js ├── pick.js ├── reset.js ├── setDate.js ├── setEndDate.js ├── setStartDate.js ├── show.js └── update.js └── options ├── autoHide.js ├── autoPick.js ├── autoShow.js ├── date.js ├── endDate.js ├── filter.js ├── format.js ├── inline.js ├── startDate.js └── startView.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env", 5 | { 6 | "modules": false 7 | } 8 | ] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 2 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb-base", 3 | "env": { 4 | "browser": true 5 | }, 6 | "rules": { 7 | "no-param-reassign": "off", 8 | "no-restricted-properties": "off" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.map 3 | -------------------------------------------------------------------------------- /.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-standard", 3 | "plugins": [ 4 | "stylelint-order" 5 | ], 6 | "rules": { 7 | "no-descending-specificity": null, 8 | "order/properties-alphabetical-order": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: node 3 | cache: npm 4 | script: npm test 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.0.10 (Sep 29, 2020) 4 | 5 | - Add some new i18n languages. 6 | 7 | ## 1.0.9 (Sep 21, 2019) 8 | 9 | - Fix the issue of converting `31/10/2019` to `01/10/2019` when the current month only has 30 days (#222). 10 | 11 | ## 1.0.8 (Jun 23, 2019) 12 | 13 | - Fix the issue of unable to pick the current month or year again (#203). 14 | 15 | ## 1.0.7 (Feb 19, 2019) 16 | 17 | - Fix unexpected month changing (#198). 18 | 19 | ## 1.0.6 (Jan 19, 2019) 20 | 21 | - Fix wrong parameter for the `$.contains` function. 22 | 23 | ## 1.0.5 (Jan 19, 2019) 24 | 25 | - Emulate click in touch devices to support hiding the picker automatically (#197). 26 | 27 | ## 1.0.4 (Jan 6, 2019) 28 | 29 | - Fix wrong future month selection when today is 31 (#195). 30 | - Fix month picking issue when the format only contains `YYYY` and `MM` (#193). 31 | 32 | ## 1.0.3 (Dec 20, 2018) 33 | 34 | - Ignore hours, minutes, seconds and milliseconds of parsed date to avoid side effect (#192) 35 | - Fix day view when the selected day is not in the current year (#194). 36 | 37 | ## 1.0.2 (Dec 15, 2018) 38 | 39 | - Convert 2-digit year to 2000+ (#186). 40 | 41 | ## 1.0.1 (Nov 14, 2018) 42 | 43 | - Fix position problem in scrollable modal (#121). 44 | - Fix the issue of the datepicker is replaced after picked a day (#128). 45 | 46 | ## 1.0.0 (Aug 5, 2018) 47 | 48 | - Show full month name in date picker header (#133). 49 | - Fix the issue of converting `0` to `1` (#168). 50 | 51 | ## 1.0.0-beta (Jun 30, 2018) 52 | 53 | - Fix the issue of years and months view rendering problem (#113). 54 | - Add a second parameter to the `filter` function option (#116, #151). 55 | - Enhance the `setStartDate` and `setEndDate` methods, supports `null` as argument (#157). 56 | - Change NPM package name scope from `@fengyuanchen` to `@chenfengyuan`. 57 | 58 | ## 0.6.5 (Mar 31, 2018) 59 | 60 | - Remove added data when destroy. 61 | - Remove unnecessary muted class from start and end years in years view (#130). 62 | 63 | ## 0.6.4 (Nov 24, 2017) 64 | 65 | - Support to load in node environment. 66 | - Add 3 new languages for i18n. 67 | - Add example for using datepicker in modal. 68 | 69 | ## 0.6.3 (Sep 29, 2017) 70 | 71 | - Update view year when the month over the current year. 72 | 73 | ## 0.6.2 (Sep 29, 2017) 74 | 75 | - Fix the issue of days of month computing (#94). 76 | 77 | ## 0.6.1 (Sep 25, 2017) 78 | 79 | - Fix color function error in the CSS. 80 | 81 | ## 0.6.0 (Sep 24, 2017) 82 | 83 | - Refactor in ES6. 84 | 85 | ## 0.5.5 (Sep 10, 2017) 86 | 87 | - Fix the issue of date range limits (#89). 88 | 89 | ## 0.5.4 (Aug 5, 2017) 90 | 91 | - Fix the issue of date repicking (#75). 92 | 93 | ## 0.5.3 (May 30, 2017) 94 | 95 | - Highlight the current year and month. 96 | - Highlight the picked year and month. 97 | 98 | ## 0.5.2 (Apr 8, 2017) 99 | 100 | - Fixed year and month picking issue. 101 | 102 | ## 0.5.1 (Mar 25, 2017) 103 | 104 | - Hide the picker when the target input element is blurred (#54). 105 | - Hide the picker when click the trigger element again. 106 | - Fixed some issues in inline mode. 107 | 108 | ## 0.5.0 (Feb 11, 2017) 109 | 110 | - Added a new option `highlightedClass` for highlight today (#28). 111 | - Fixed the position of picker panel (#49). 112 | 113 | ## 0.4.0 (Oct 15, 2016) 114 | 115 | - Rename `autoshow` option to `autoShow`. 116 | - Rename `autohide` option to `autoHide`. 117 | - Rename `autopick` option to `autoPick`. 118 | - Improved the priority of language options. 119 | - Fixed the issue of date view updating (#33). 120 | 121 | ## 0.3.1 (Jan 11, 2016) 122 | 123 | - Fixed the issue of `startDate` option (#20) 124 | 125 | ## 0.3.0 (Dec 15, 2015) 126 | 127 | - Change the default value of `zIndex` option from `1` to `1000` 128 | - Simplify JavaScript code 129 | - Optimize CSS code styles 130 | 131 | ## 0.2.2 (Dec 10, 2015) 132 | 133 | - Fixed the issue of options overriding (#15) 134 | - Fixed the error of next view month 135 | 136 | ## 0.2.1 (Oct 26, 2015) 137 | 138 | - Fixed the error of month picker 139 | 140 | ## 0.2.0 (Oct 18, 2015) 141 | 142 | - Supports custom events 143 | - Supports to set start view date and end view date 144 | - Improved i18n (internationalization) 145 | - Improved placement of the datepicker 146 | - Improved template 147 | 148 | ### Options 149 | 150 | - Added 10 options: `autoshow`, `autopick`, `offset`, `language`, `startDate`, `endDate`, `mutedClass`, `show`, `hide`, `pick` 151 | - Renamed `autoclose` to `autohide` 152 | - Renamed `dateFormat` to `format` 153 | - Renamed `viewStart` to `startView` 154 | - Renamed `showMonthAfterYear` to `yearFirst` 155 | - Renamed `selectedClass` to `pickedClass` 156 | - Renamed `isDisabled` to `filter` 157 | 158 | ### Methods 159 | 160 | - Added 11 methods: `pick`, `reset`, `getMonthName`, `getDayName`, `getDate`, `setDate`, `setStartDate`, `setEndDate`, `parseDate`, `formatDate`, `destroy` 161 | - Removed 2 methods: `enable`, `disable` 162 | 163 | ### Events 164 | 165 | - Added 3 events: `show.datepicker`, `hide.datepicker`, `pick.datepicker` 166 | 167 | ## 0.1.0 (Aug 9, 2014) 168 | 169 | - Fixed some bugs 170 | - Added i18n files 171 | - Optimized code style 172 | 173 | ## 0.1.0-beta (Feb 14, 2014) 174 | 175 | - Supports 21 options: `date`, `dateFormat`, `disabledClass`, `selectedClass`, `autoclose`, `inline`, `trigger`, `container`, `showMonthAfterYear`, `zIndex`, `viewStart`, `weekStart`, `yearSuffix`, `days`, `daysShort`, `daysMin`, `months`, `monthsShort`, `itemTag`, `template`, `isDisabled` 176 | - Supports 5 methods: `show`, `hide`, `enable`, `disable`, `update` 177 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2014-present Chen Fengyuan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Datepicker 2 | 3 | [![Build Status](https://img.shields.io/travis/fengyuanchen/datepicker.svg)](https://travis-ci.org/fengyuanchen/datepicker) [![Downloads](https://img.shields.io/npm/dm/@chenfengyuan/datepicker.svg)](https://www.npmjs.com/package/@chenfengyuan/datepicker) [![Version](https://img.shields.io/npm/v/@chenfengyuan/datepicker.svg)](https://www.npmjs.com/package/@chenfengyuan/datepicker) 4 | 5 | > A simple jQuery datepicker plugin. 6 | 7 | - [Website](https://fengyuanchen.github.io/datepicker) 8 | 9 | ## Table of contents 10 | 11 | - [Features](#features) 12 | - [Main](#main) 13 | - [Getting started](#getting-started) 14 | - [Options](#options) 15 | - [Methods](#methods) 16 | - [Events](#events) 17 | - [I18n](#i18n) 18 | - [No conflict](#no-conflict) 19 | - [Browser support](#browser-support) 20 | - [Versioning](#versioning) 21 | - [License](#license) 22 | 23 | ## Features 24 | 25 | - Supports [options](#options) 26 | - Supports [methods](#methods) 27 | - Supports [events](#events) 28 | - Supports inline mode 29 | - Supports touch (mobile) 30 | - Supports internationalization 31 | - Cross-browser support 32 | 33 | ## Main 34 | 35 | ```text 36 | dist/ 37 | ├── datepicker.css 38 | ├── datepicker.min.css (compressed) 39 | ├── datepicker.js (UMD) 40 | ├── datepicker.min.js (UMD, compressed) 41 | ├── datepicker.common.js (CommonJS, default) 42 | └── datepicker.esm.js (ES Module) 43 | ``` 44 | 45 | ## Getting started 46 | 47 | ### Install 48 | 49 | ```shell 50 | npm install @chenfengyuan/datepicker 51 | ``` 52 | 53 | Include files: 54 | 55 | ```html 56 | 57 | 58 | 59 | ``` 60 | 61 | ### Usage 62 | 63 | Initialize with `$.fn.datepicker` method. 64 | 65 | ```html 66 | 67 | 68 |
69 | ``` 70 | 71 | ```js 72 | $('[data-toggle="datepicker"]').datepicker(); 73 | ``` 74 | 75 | [⬆ back to top](#table-of-contents) 76 | 77 | ## Options 78 | 79 | You may set datepicker options with `$().datepicker(options)`. 80 | If you want to change the global default options, You may use `$.fn.datepicker.setDefaults(options)`. 81 | 82 | ### autoShow 83 | 84 | - Type: `Boolean` 85 | - Default: `false` 86 | 87 | Show the datepicker automatically when initialized. 88 | 89 | ### autoHide 90 | 91 | - Type: `Boolean` 92 | - Default: `false` 93 | 94 | Hide the datepicker automatically when picked. 95 | 96 | ### autoPick 97 | 98 | - Type: `Boolean` 99 | - Default: `false` 100 | 101 | Pick the initial date automatically when initialized. 102 | 103 | ### inline 104 | 105 | - Type: `Boolean` 106 | - Default: `false` 107 | 108 | Enable inline mode. 109 | 110 | If the element is not an input element, will append the datepicker to the element. 111 | If the `container` option is set, will append the datepicker to the container. 112 | 113 | ### container 114 | 115 | - Type: `Element` or `String`(selector) 116 | - Default: `null` 117 | 118 | A element for putting the datepicker. If not set, the datepicker will be appended to `document.body` by default. 119 | 120 | > Only works when the `inline` option set to `true`. 121 | 122 | ### trigger 123 | 124 | - Type: `Element` or `String`(selector) 125 | - Default: `null` 126 | 127 | A element for triggering the datepicker. 128 | 129 | ### language 130 | 131 | - Type: `String` 132 | - Default: `''` 133 | 134 | The ISO language code. If not set, will use the built-in language (`en-US`) by default. 135 | 136 | > You should define the language first. View the [I18n](#i18n) section for more information or check out the [`i18n`](i18n) folder for available languages. 137 | 138 | ```js 139 | $().datepicker({ 140 | language: 'en-GB' 141 | }); 142 | ``` 143 | 144 | ### format 145 | 146 | - Type: `String` 147 | - Default: `'mm/dd/yyyy'` 148 | - Available date placeholders: 149 | - Year: `yyyy`, `yy` 150 | - Month: `mm`, `m` 151 | - Day: `dd`, `d` 152 | 153 | The date string format. 154 | 155 | ```js 156 | $().datepicker({ 157 | format: 'yyyy-mm-dd' 158 | }); 159 | ``` 160 | 161 | ### date 162 | 163 | - Type: `Date` or `String` 164 | - Default: `null` 165 | 166 | The initial date. If not set, will use the current date by default. 167 | 168 | ```js 169 | $().datepicker({ 170 | date: new Date(2014, 1, 14) // Or '02/14/2014' 171 | }); 172 | ``` 173 | 174 | ### startDate 175 | 176 | - Type: `Date` or `String` 177 | - Default: `null` 178 | 179 | The start view date. All the dates before this date will be disabled. 180 | 181 | ### endDate 182 | 183 | - Type: `Date` or `String` 184 | - Default: `null` 185 | 186 | The end view date. All the dates after this date will be disabled. 187 | 188 | ### startView 189 | 190 | - Type: `Number` 191 | - Default: `0` 192 | - Options: 193 | - `0`: days 194 | - `1`: months 195 | - `2`: years 196 | 197 | The start view when initialized. 198 | 199 | ### weekStart 200 | 201 | - Type: `Number` 202 | - Default: `0` 203 | - Options: 204 | - `0`: Sunday 205 | - `1`: Monday 206 | - `2`: Tuesday 207 | - `3`: Wednesday 208 | - `4`: Thursday 209 | - `5`: Friday 210 | - `6`: Saturday 211 | 212 | The start day of the week. 213 | 214 | ### yearFirst 215 | 216 | - Type: `Boolean` 217 | - Default: `false` 218 | 219 | Show year before month on the datepicker header 220 | 221 | ### yearSuffix 222 | 223 | - Type: `String` 224 | - Default: `''` 225 | 226 | A string suffix to the year number. 227 | 228 | ```js 229 | $().datepicker({ 230 | yearSuffix: '年' 231 | }); 232 | ``` 233 | 234 | ### days 235 | 236 | - Type: `Array` 237 | - Default: `['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']` 238 | 239 | Days' name of the week. 240 | 241 | ### daysShort 242 | 243 | - Type: `Array` 244 | - Default: `['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']` 245 | 246 | Shorter days' name. 247 | 248 | ### daysMin 249 | 250 | - Type: `Array` 251 | - Default: `['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']` 252 | 253 | Shortest days' name. 254 | 255 | ### months 256 | 257 | - Type: `Array` 258 | - Default: `['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']` 259 | 260 | Months' name. 261 | 262 | ### monthsShort 263 | 264 | - Type: `Array` 265 | - Default: `['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']` 266 | 267 | Shorter months' name. 268 | 269 | ### itemTag 270 | 271 | - Type: `String` 272 | - Default: `'li'` 273 | 274 | A element tag for each item of years, months and days. 275 | 276 | ### mutedClass 277 | 278 | - Type: `String` 279 | - Default: `'muted'` 280 | 281 | A class (CSS) for muted item. 282 | 283 | ### pickedClass 284 | 285 | - Type: `String` 286 | - Default: `'picked'` 287 | 288 | A class (CSS) for picked item. 289 | 290 | ### disabledClass 291 | 292 | - Type: `String` 293 | - Default: `'disabled'` 294 | 295 | A class (CSS) for disabled item. 296 | 297 | ### highlightedClass 298 | 299 | - Type: `String` 300 | - Default: `'highlighted'` 301 | 302 | A class (CSS) for highlight date item. 303 | 304 | ### template 305 | 306 | - Type: `String` 307 | - Default: 308 | 309 | ```html 310 |
311 |
312 | 317 | 318 |
319 |
320 | 325 | 326 |
327 |
328 | 333 | 334 | 335 |
336 |
337 | ``` 338 | 339 | The template of the datepicker. 340 | 341 | **Note:** All the `data-view` attributes must be set when you customize it. 342 | 343 | ### offset 344 | 345 | - Type: `Number` 346 | - Default: `10` 347 | 348 | The offset top or bottom of the datepicker from the element. 349 | 350 | ### zIndex 351 | 352 | - Type: `Number` 353 | - Default: `1` 354 | 355 | The CSS `z-index` style for the datepicker. 356 | 357 | ### filter 358 | 359 | - Type: `Function` 360 | - Default: `null` 361 | - Syntax: `filter(date, view)` 362 | - `date`: the date for checking. 363 | - `view`: the the current view, one of `day`, `month` or `year`. 364 | 365 | Filter each date item. If return a `false` value, the related date will be disabled. 366 | 367 | ```js 368 | var now = Date.now(); 369 | 370 | $().datepicker({ 371 | filter: function(date, view) { 372 | if (date.getDay() === 0 && view === 'day') { 373 | return false; // Disable all Sundays, but still leave months/years, whose first day is a Sunday, enabled. 374 | } 375 | } 376 | }); 377 | ``` 378 | 379 | ### show 380 | 381 | - Type: `Function` 382 | - Default: `null` 383 | 384 | A shortcut of the "show.datepicker" event. 385 | 386 | ### hide 387 | 388 | - Type: `Function` 389 | - Default: `null` 390 | 391 | A shortcut of the "hide.datepicker" event. 392 | 393 | ### pick 394 | 395 | - Type: `Function` 396 | - Default: `null` 397 | 398 | A shortcut of the "pick.datepicker" event. 399 | 400 | [⬆ back to top](#table-of-contents) 401 | 402 | ## Methods 403 | 404 | Common usage: 405 | 406 | ```js 407 | $().datepicker('method', argument1, , argument2, ..., argumentN); 408 | ``` 409 | 410 | ### show() 411 | 412 | Show the datepicker. 413 | 414 | ### hide() 415 | 416 | Hide the datepicker. 417 | 418 | ### update() 419 | 420 | Update the datepicker with the value or text of the current element. 421 | 422 | ### pick() 423 | 424 | Pick the current date to the element. 425 | 426 | ### reset() 427 | 428 | Reset the datepicker. 429 | 430 | ### getMonthName([month[, short]]) 431 | 432 | - **month** (optional): 433 | - Type: `Number` 434 | - Default: the month of the current date 435 | 436 | - **short** (optional): 437 | - Type: `Boolean` 438 | - Default: `false` 439 | - Get the shorter month name 440 | 441 | - (return value): 442 | - Type: `String` 443 | 444 | Get the month name with given argument or the current date. 445 | 446 | ```js 447 | $().datepicker('getMonthName'); // 'January' 448 | $().datepicker('getMonthName', true); // 'Jan' 449 | $().datepicker('getMonthName', 11); // 'December' 450 | $().datepicker('getMonthName', 11, true); // 'Dec' 451 | ``` 452 | 453 | ### getDayName([day[, short[, min]]) 454 | 455 | - **day** (optional): 456 | - Type: `Number` 457 | - Default: the day of the current date 458 | 459 | - **short** (optional): 460 | - Type: `Boolean` 461 | - Default: `false` 462 | - Get the shorter day name 463 | 464 | - **min** (optional): 465 | - Type: `Boolean` 466 | - Default: `false` 467 | - Get the shortest day name 468 | 469 | - (return value): 470 | - Type: `String` 471 | 472 | Get the day name with given argument or the current date. 473 | 474 | ```js 475 | $().datepicker('getDayName'); // 'Sunday' 476 | $().datepicker('getDayName', true); // 'Sun' 477 | $().datepicker('getDayName', true, true); // 'Su' 478 | $().datepicker('getDayName', 6); // 'Saturday' 479 | $().datepicker('getDayName', 6, true); // 'Sat' 480 | $().datepicker('getDayName', 6, true, true); // 'Sa' 481 | ``` 482 | 483 | ### getDate([formatted]) 484 | 485 | - **formatted** (optional): 486 | - Type: `Boolean` 487 | - Default: `false` 488 | - Get a formatted date string 489 | 490 | - (return value): 491 | - Type: `Date` or `String` 492 | 493 | Get the current date. 494 | 495 | ```js 496 | $().datepicker('getDate'); // date object 497 | $().datepicker('getDate', true); // '02/14/2014' 498 | ``` 499 | 500 | ### setDate(date) 501 | 502 | - **date**: 503 | - Type: `Date` or `String` 504 | 505 | Set the current date with a new date. 506 | 507 | ```js 508 | $().datepicker('setDate', new Date(2014, 1, 14)); 509 | $().datepicker('setDate', '02/14/2014'); 510 | ``` 511 | 512 | ### setStartDate(date) 513 | 514 | - **date**: 515 | - Type: `Date` or `String` or `null` 516 | 517 | Set the start view date with a new date. 518 | 519 | ### setEndDate(date) 520 | 521 | - **date**: 522 | - Type: `Date` or `String` or `null` 523 | 524 | Set the end view date with a new date. 525 | 526 | ### parseDate(date) 527 | 528 | - **date**: 529 | - Type: `String` 530 | 531 | Parse a date string with the set date format. 532 | 533 | ```js 534 | $().datepicker('parseDate', '02/14/2014'); // date object 535 | ``` 536 | 537 | ### formatDate(date) 538 | 539 | - **date**: 540 | - Type: `Date` 541 | 542 | Format a date object to a string with the set date format. 543 | 544 | ```js 545 | $().datepicker('formatDate', new Date(2014, 1, 14)); // '02/14/2014' 546 | ``` 547 | 548 | ### destroy() 549 | 550 | Destroy the datepicker and remove the instance from the target element. 551 | 552 | [⬆ back to top](#table-of-contents) 553 | 554 | ## Events 555 | 556 | ### show.datepicker 557 | 558 | This event fires when starts to show the datepicker. 559 | 560 | ### hide.datepicker 561 | 562 | This event fires when starts to hide the datepicker. 563 | 564 | ### pick.datepicker 565 | 566 | - **event.date**: 567 | - Type: `Date` 568 | - The current date 569 | 570 | - **event.view**: 571 | - Type: `String` 572 | - Default: `''` 573 | - Options: `'year'`, `'month'`, `'day'` 574 | - The current visible view 575 | 576 | This event fires when start to pick a year, month or day. 577 | 578 | ```js 579 | $().on('pick.datepicker', function (e) { 580 | if (e.date < new Date()) { 581 | e.preventDefault(); // Prevent to pick the date 582 | } 583 | }); 584 | ``` 585 | 586 | [⬆ back to top](#table-of-contents) 587 | 588 | ## I18n 589 | 590 | ```js 591 | // datepicker.zh-CN.js 592 | $.fn.datepicker.languages['zh-CN'] = { 593 | format: 'yyyy年mm月dd日', 594 | days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], 595 | daysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], 596 | daysMin: ['日', '一', '二', '三', '四', '五', '六'], 597 | months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], 598 | monthsShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], 599 | weekStart: 1, 600 | startView: 0, 601 | yearFirst: true, 602 | yearSuffix: '年' 603 | }; 604 | ``` 605 | 606 | ```html 607 | 608 | 609 | 614 | ``` 615 | 616 | [⬆ back to top](#table-of-contents) 617 | 618 | ## No conflict 619 | 620 | If you have to use other plugin with the same namespace, just call the `$.fn.datepicker.noConflict` method to revert to it. 621 | 622 | ```html 623 | 624 | 625 | 629 | ``` 630 | 631 | ## Browser support 632 | 633 | - Chrome (latest) 634 | - Firefox (latest) 635 | - Safari (latest) 636 | - Opera (latest) 637 | - Edge (latest) 638 | - Internet Explorer 9+ 639 | 640 | ## Versioning 641 | 642 | Maintained under the [Semantic Versioning guidelines](https://semver.org/). 643 | 644 | ## License 645 | 646 | [MIT](https://opensource.org/licenses/MIT) © [Chen Fengyuan](https://chenfengyuan.com/) 647 | 648 | [⬆ back to top](#table-of-contents) 649 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fengyuanchen/datepicker", 3 | "license": "MIT", 4 | "repositories": [ 5 | { 6 | "type": "vcs", 7 | "url": "https://github.com/fengyuanchen/datepicker" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /dist/datepicker.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Datepicker v1.0.10 3 | * https://fengyuanchen.github.io/datepicker 4 | * 5 | * Copyright 2014-present Chen Fengyuan 6 | * Released under the MIT license 7 | * 8 | * Date: 2020-09-29T14:46:09.037Z 9 | */ 10 | 11 | .datepicker-container { 12 | background-color: #fff; 13 | direction: ltr; 14 | font-size: 12px; 15 | left: 0; 16 | line-height: 30px; 17 | position: fixed; 18 | -webkit-tap-highlight-color: transparent; 19 | top: 0; 20 | -ms-touch-action: none; 21 | touch-action: none; 22 | -webkit-touch-callout: none; 23 | -webkit-user-select: none; 24 | -moz-user-select: none; 25 | -ms-user-select: none; 26 | user-select: none; 27 | width: 210px; 28 | z-index: -1; 29 | } 30 | 31 | .datepicker-container::before, 32 | .datepicker-container::after { 33 | border: 5px solid transparent; 34 | content: " "; 35 | display: block; 36 | height: 0; 37 | position: absolute; 38 | width: 0; 39 | } 40 | 41 | .datepicker-dropdown { 42 | border: 1px solid #ccc; 43 | -webkit-box-shadow: 0 3px 6px #ccc; 44 | box-shadow: 0 3px 6px #ccc; 45 | -webkit-box-sizing: content-box; 46 | box-sizing: content-box; 47 | position: absolute; 48 | z-index: 1; 49 | } 50 | 51 | .datepicker-inline { 52 | position: static; 53 | } 54 | 55 | .datepicker-top-left, 56 | .datepicker-top-right { 57 | border-top-color: #39f; 58 | } 59 | 60 | .datepicker-top-left::before, 61 | .datepicker-top-left::after, 62 | .datepicker-top-right::before, 63 | .datepicker-top-right::after { 64 | border-top: 0; 65 | left: 10px; 66 | top: -5px; 67 | } 68 | 69 | .datepicker-top-left::before, 70 | .datepicker-top-right::before { 71 | border-bottom-color: #39f; 72 | } 73 | 74 | .datepicker-top-left::after, 75 | .datepicker-top-right::after { 76 | border-bottom-color: #fff; 77 | top: -4px; 78 | } 79 | 80 | .datepicker-bottom-left, 81 | .datepicker-bottom-right { 82 | border-bottom-color: #39f; 83 | } 84 | 85 | .datepicker-bottom-left::before, 86 | .datepicker-bottom-left::after, 87 | .datepicker-bottom-right::before, 88 | .datepicker-bottom-right::after { 89 | border-bottom: 0; 90 | bottom: -5px; 91 | left: 10px; 92 | } 93 | 94 | .datepicker-bottom-left::before, 95 | .datepicker-bottom-right::before { 96 | border-top-color: #39f; 97 | } 98 | 99 | .datepicker-bottom-left::after, 100 | .datepicker-bottom-right::after { 101 | border-top-color: #fff; 102 | bottom: -4px; 103 | } 104 | 105 | .datepicker-top-right::before, 106 | .datepicker-top-right::after, 107 | .datepicker-bottom-right::before, 108 | .datepicker-bottom-right::after { 109 | left: auto; 110 | right: 10px; 111 | } 112 | 113 | .datepicker-panel > ul { 114 | margin: 0; 115 | padding: 0; 116 | width: 102%; 117 | } 118 | 119 | .datepicker-panel > ul::before, 120 | .datepicker-panel > ul::after { 121 | content: " "; 122 | display: table; 123 | } 124 | 125 | .datepicker-panel > ul::after { 126 | clear: both; 127 | } 128 | 129 | .datepicker-panel > ul > li { 130 | background-color: #fff; 131 | cursor: pointer; 132 | float: left; 133 | height: 30px; 134 | list-style: none; 135 | margin: 0; 136 | padding: 0; 137 | text-align: center; 138 | width: 30px; 139 | } 140 | 141 | .datepicker-panel > ul > li:hover { 142 | background-color: rgb(229, 242, 255); 143 | } 144 | 145 | .datepicker-panel > ul > li.muted, 146 | .datepicker-panel > ul > li.muted:hover { 147 | color: #999; 148 | } 149 | 150 | .datepicker-panel > ul > li.highlighted { 151 | background-color: rgb(229, 242, 255); 152 | } 153 | 154 | .datepicker-panel > ul > li.highlighted:hover { 155 | background-color: rgb(204, 229, 255); 156 | } 157 | 158 | .datepicker-panel > ul > li.picked, 159 | .datepicker-panel > ul > li.picked:hover { 160 | color: #39f; 161 | } 162 | 163 | .datepicker-panel > ul > li.disabled, 164 | .datepicker-panel > ul > li.disabled:hover { 165 | background-color: #fff; 166 | color: #ccc; 167 | cursor: default; 168 | } 169 | 170 | .datepicker-panel > ul > li.disabled.highlighted, 171 | .datepicker-panel > ul > li.disabled:hover.highlighted { 172 | background-color: rgb(229, 242, 255); 173 | } 174 | 175 | .datepicker-panel > ul > li[data-view="years prev"], 176 | .datepicker-panel > ul > li[data-view="year prev"], 177 | .datepicker-panel > ul > li[data-view="month prev"], 178 | .datepicker-panel > ul > li[data-view="years next"], 179 | .datepicker-panel > ul > li[data-view="year next"], 180 | .datepicker-panel > ul > li[data-view="month next"], 181 | .datepicker-panel > ul > li[data-view="next"] { 182 | font-size: 18px; 183 | } 184 | 185 | .datepicker-panel > ul > li[data-view="years current"], 186 | .datepicker-panel > ul > li[data-view="year current"], 187 | .datepicker-panel > ul > li[data-view="month current"] { 188 | width: 150px; 189 | } 190 | 191 | .datepicker-panel > ul[data-view="years"] > li, 192 | .datepicker-panel > ul[data-view="months"] > li { 193 | height: 52.5px; 194 | line-height: 52.5px; 195 | width: 52.5px; 196 | } 197 | 198 | .datepicker-panel > ul[data-view="week"] > li, 199 | .datepicker-panel > ul[data-view="week"] > li:hover { 200 | background-color: #fff; 201 | cursor: default; 202 | } 203 | 204 | .datepicker-hide { 205 | display: none; 206 | } 207 | -------------------------------------------------------------------------------- /dist/datepicker.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Datepicker v1.0.10 3 | * https://fengyuanchen.github.io/datepicker 4 | * 5 | * Copyright 2014-present Chen Fengyuan 6 | * Released under the MIT license 7 | * 8 | * Date: 2020-09-29T14:46:09.037Z 9 | */.datepicker-container{background-color:#fff;direction:ltr;font-size:12px;left:0;line-height:30px;position:fixed;-webkit-tap-highlight-color:transparent;top:0;-ms-touch-action:none;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:210px;z-index:-1}.datepicker-container:after,.datepicker-container:before{border:5px solid transparent;content:" ";display:block;height:0;position:absolute;width:0}.datepicker-dropdown{border:1px solid #ccc;-webkit-box-shadow:0 3px 6px #ccc;box-shadow:0 3px 6px #ccc;-webkit-box-sizing:content-box;box-sizing:content-box;position:absolute;z-index:1}.datepicker-inline{position:static}.datepicker-top-left,.datepicker-top-right{border-top-color:#39f}.datepicker-top-left:after,.datepicker-top-left:before,.datepicker-top-right:after,.datepicker-top-right:before{border-top:0;left:10px;top:-5px}.datepicker-top-left:before,.datepicker-top-right:before{border-bottom-color:#39f}.datepicker-top-left:after,.datepicker-top-right:after{border-bottom-color:#fff;top:-4px}.datepicker-bottom-left,.datepicker-bottom-right{border-bottom-color:#39f}.datepicker-bottom-left:after,.datepicker-bottom-left:before,.datepicker-bottom-right:after,.datepicker-bottom-right:before{border-bottom:0;bottom:-5px;left:10px}.datepicker-bottom-left:before,.datepicker-bottom-right:before{border-top-color:#39f}.datepicker-bottom-left:after,.datepicker-bottom-right:after{border-top-color:#fff;bottom:-4px}.datepicker-bottom-right:after,.datepicker-bottom-right:before,.datepicker-top-right:after,.datepicker-top-right:before{left:auto;right:10px}.datepicker-panel>ul{margin:0;padding:0;width:102%}.datepicker-panel>ul:after,.datepicker-panel>ul:before{content:" ";display:table}.datepicker-panel>ul:after{clear:both}.datepicker-panel>ul>li{background-color:#fff;cursor:pointer;float:left;height:30px;list-style:none;margin:0;padding:0;text-align:center;width:30px}.datepicker-panel>ul>li:hover{background-color:#e5f2ff}.datepicker-panel>ul>li.muted,.datepicker-panel>ul>li.muted:hover{color:#999}.datepicker-panel>ul>li.highlighted{background-color:#e5f2ff}.datepicker-panel>ul>li.highlighted:hover{background-color:#cce5ff}.datepicker-panel>ul>li.picked,.datepicker-panel>ul>li.picked:hover{color:#39f}.datepicker-panel>ul>li.disabled,.datepicker-panel>ul>li.disabled:hover{background-color:#fff;color:#ccc;cursor:default}.datepicker-panel>ul>li.disabled.highlighted,.datepicker-panel>ul>li.disabled:hover.highlighted{background-color:#e5f2ff}.datepicker-panel>ul>li[data-view="month next"],.datepicker-panel>ul>li[data-view="month prev"],.datepicker-panel>ul>li[data-view="year next"],.datepicker-panel>ul>li[data-view="year prev"],.datepicker-panel>ul>li[data-view="years next"],.datepicker-panel>ul>li[data-view="years prev"],.datepicker-panel>ul>li[data-view=next]{font-size:18px}.datepicker-panel>ul>li[data-view="month current"],.datepicker-panel>ul>li[data-view="year current"],.datepicker-panel>ul>li[data-view="years current"]{width:150px}.datepicker-panel>ul[data-view=months]>li,.datepicker-panel>ul[data-view=years]>li{height:52.5px;line-height:52.5px;width:52.5px}.datepicker-panel>ul[data-view=week]>li,.datepicker-panel>ul[data-view=week]>li:hover{background-color:#fff;cursor:default}.datepicker-hide{display:none} -------------------------------------------------------------------------------- /docs/css/datepicker.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Datepicker v1.0.10 3 | * https://fengyuanchen.github.io/datepicker 4 | * 5 | * Copyright 2014-present Chen Fengyuan 6 | * Released under the MIT license 7 | * 8 | * Date: 2020-09-29T14:46:09.037Z 9 | */ 10 | 11 | .datepicker-container { 12 | background-color: #fff; 13 | direction: ltr; 14 | font-size: 12px; 15 | left: 0; 16 | line-height: 30px; 17 | position: fixed; 18 | -webkit-tap-highlight-color: transparent; 19 | top: 0; 20 | -ms-touch-action: none; 21 | touch-action: none; 22 | -webkit-touch-callout: none; 23 | -webkit-user-select: none; 24 | -moz-user-select: none; 25 | -ms-user-select: none; 26 | user-select: none; 27 | width: 210px; 28 | z-index: -1; 29 | } 30 | 31 | .datepicker-container::before, 32 | .datepicker-container::after { 33 | border: 5px solid transparent; 34 | content: " "; 35 | display: block; 36 | height: 0; 37 | position: absolute; 38 | width: 0; 39 | } 40 | 41 | .datepicker-dropdown { 42 | border: 1px solid #ccc; 43 | -webkit-box-shadow: 0 3px 6px #ccc; 44 | box-shadow: 0 3px 6px #ccc; 45 | -webkit-box-sizing: content-box; 46 | box-sizing: content-box; 47 | position: absolute; 48 | z-index: 1; 49 | } 50 | 51 | .datepicker-inline { 52 | position: static; 53 | } 54 | 55 | .datepicker-top-left, 56 | .datepicker-top-right { 57 | border-top-color: #39f; 58 | } 59 | 60 | .datepicker-top-left::before, 61 | .datepicker-top-left::after, 62 | .datepicker-top-right::before, 63 | .datepicker-top-right::after { 64 | border-top: 0; 65 | left: 10px; 66 | top: -5px; 67 | } 68 | 69 | .datepicker-top-left::before, 70 | .datepicker-top-right::before { 71 | border-bottom-color: #39f; 72 | } 73 | 74 | .datepicker-top-left::after, 75 | .datepicker-top-right::after { 76 | border-bottom-color: #fff; 77 | top: -4px; 78 | } 79 | 80 | .datepicker-bottom-left, 81 | .datepicker-bottom-right { 82 | border-bottom-color: #39f; 83 | } 84 | 85 | .datepicker-bottom-left::before, 86 | .datepicker-bottom-left::after, 87 | .datepicker-bottom-right::before, 88 | .datepicker-bottom-right::after { 89 | border-bottom: 0; 90 | bottom: -5px; 91 | left: 10px; 92 | } 93 | 94 | .datepicker-bottom-left::before, 95 | .datepicker-bottom-right::before { 96 | border-top-color: #39f; 97 | } 98 | 99 | .datepicker-bottom-left::after, 100 | .datepicker-bottom-right::after { 101 | border-top-color: #fff; 102 | bottom: -4px; 103 | } 104 | 105 | .datepicker-top-right::before, 106 | .datepicker-top-right::after, 107 | .datepicker-bottom-right::before, 108 | .datepicker-bottom-right::after { 109 | left: auto; 110 | right: 10px; 111 | } 112 | 113 | .datepicker-panel > ul { 114 | margin: 0; 115 | padding: 0; 116 | width: 102%; 117 | } 118 | 119 | .datepicker-panel > ul::before, 120 | .datepicker-panel > ul::after { 121 | content: " "; 122 | display: table; 123 | } 124 | 125 | .datepicker-panel > ul::after { 126 | clear: both; 127 | } 128 | 129 | .datepicker-panel > ul > li { 130 | background-color: #fff; 131 | cursor: pointer; 132 | float: left; 133 | height: 30px; 134 | list-style: none; 135 | margin: 0; 136 | padding: 0; 137 | text-align: center; 138 | width: 30px; 139 | } 140 | 141 | .datepicker-panel > ul > li:hover { 142 | background-color: rgb(229, 242, 255); 143 | } 144 | 145 | .datepicker-panel > ul > li.muted, 146 | .datepicker-panel > ul > li.muted:hover { 147 | color: #999; 148 | } 149 | 150 | .datepicker-panel > ul > li.highlighted { 151 | background-color: rgb(229, 242, 255); 152 | } 153 | 154 | .datepicker-panel > ul > li.highlighted:hover { 155 | background-color: rgb(204, 229, 255); 156 | } 157 | 158 | .datepicker-panel > ul > li.picked, 159 | .datepicker-panel > ul > li.picked:hover { 160 | color: #39f; 161 | } 162 | 163 | .datepicker-panel > ul > li.disabled, 164 | .datepicker-panel > ul > li.disabled:hover { 165 | background-color: #fff; 166 | color: #ccc; 167 | cursor: default; 168 | } 169 | 170 | .datepicker-panel > ul > li.disabled.highlighted, 171 | .datepicker-panel > ul > li.disabled:hover.highlighted { 172 | background-color: rgb(229, 242, 255); 173 | } 174 | 175 | .datepicker-panel > ul > li[data-view="years prev"], 176 | .datepicker-panel > ul > li[data-view="year prev"], 177 | .datepicker-panel > ul > li[data-view="month prev"], 178 | .datepicker-panel > ul > li[data-view="years next"], 179 | .datepicker-panel > ul > li[data-view="year next"], 180 | .datepicker-panel > ul > li[data-view="month next"], 181 | .datepicker-panel > ul > li[data-view="next"] { 182 | font-size: 18px; 183 | } 184 | 185 | .datepicker-panel > ul > li[data-view="years current"], 186 | .datepicker-panel > ul > li[data-view="year current"], 187 | .datepicker-panel > ul > li[data-view="month current"] { 188 | width: 150px; 189 | } 190 | 191 | .datepicker-panel > ul[data-view="years"] > li, 192 | .datepicker-panel > ul[data-view="months"] > li { 193 | height: 52.5px; 194 | line-height: 52.5px; 195 | width: 52.5px; 196 | } 197 | 198 | .datepicker-panel > ul[data-view="week"] > li, 199 | .datepicker-panel > ul[data-view="week"] > li:hover { 200 | background-color: #fff; 201 | cursor: default; 202 | } 203 | 204 | .datepicker-hide { 205 | display: none; 206 | } 207 | -------------------------------------------------------------------------------- /docs/css/main.css: -------------------------------------------------------------------------------- 1 | .d-flex > .btn { 2 | flex: 1; 3 | } 4 | 5 | .carbonads { 6 | border: 1px solid #ccc; 7 | border-radius: 0.25rem; 8 | font-size: 0.875rem; 9 | overflow: hidden; 10 | padding: 1rem; 11 | } 12 | 13 | .carbon-wrap { 14 | overflow: hidden; 15 | } 16 | 17 | .carbon-img { 18 | clear: left; 19 | display: block; 20 | float: left; 21 | } 22 | 23 | .carbon-text, 24 | .carbon-poweredby { 25 | display: block; 26 | margin-left: 140px; 27 | } 28 | 29 | .carbon-text, 30 | .carbon-text:hover, 31 | .carbon-text:focus { 32 | color: #fff; 33 | text-decoration: none; 34 | } 35 | 36 | .carbon-poweredby, 37 | .carbon-poweredby:hover, 38 | .carbon-poweredby:focus { 39 | color: #ddd; 40 | text-decoration: none; 41 | } 42 | 43 | @media (min-width: 768px) { 44 | .carbonads { 45 | float: right; 46 | margin-bottom: -1rem; 47 | margin-top: -1rem; 48 | max-width: 360px; 49 | } 50 | } 51 | 52 | .footer { 53 | font-size: 0.875rem; 54 | } 55 | 56 | .heart { 57 | color: #ddd; 58 | display: block; 59 | height: 2rem; 60 | line-height: 2rem; 61 | margin-bottom: 0; 62 | margin-top: 1rem; 63 | position: relative; 64 | text-align: center; 65 | width: 100%; 66 | } 67 | 68 | .heart:hover { 69 | color: #ff4136; 70 | } 71 | 72 | .heart::before { 73 | border-top: 1px solid #eee; 74 | content: " "; 75 | display: block; 76 | height: 0; 77 | left: 0; 78 | position: absolute; 79 | right: 0; 80 | top: 50%; 81 | } 82 | 83 | .heart::after { 84 | background-color: #fff; 85 | content: "♥"; 86 | padding-left: 0.5rem; 87 | padding-right: 0.5rem; 88 | position: relative; 89 | z-index: 1; 90 | } 91 | 92 | .docs-datepicker-container { 93 | border: 1px dashed #eee; 94 | display: none; 95 | margin: 10px auto; 96 | min-height: 160px; 97 | position: relative; 98 | } 99 | 100 | .docs-datepicker-container::before { 101 | color: #ccc; 102 | content: 'Container for inline datepicker'; 103 | font-size: 12px; 104 | left: 50%; 105 | line-height: 20px; 106 | margin-left: -82px; 107 | margin-top: -10px; 108 | position: absolute; 109 | top: 50%; 110 | z-index: -1; 111 | } 112 | 113 | .docs-datepicker-container > .datepicker-container { 114 | margin: 10px auto; 115 | } 116 | 117 | .docs-options > .input-group { 118 | margin-bottom: 10px; 119 | } 120 | 121 | .docs-options > .input-group .input-group-text { 122 | justify-content: center; 123 | min-width: 6rem; 124 | } 125 | 126 | .docs-actions > .input-group, 127 | .docs-actions > .btn-group, 128 | .docs-actions > .btn { 129 | margin-bottom: 10px; 130 | } 131 | -------------------------------------------------------------------------------- /docs/examples/date-range.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Datepicker 8 | 9 | 10 | 11 | 12 |
13 |

Date range

14 | 15 |
16 |
17 | Date range 18 |
19 | 20 | 21 |
22 |
23 | 24 | 25 | 26 | 27 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/examples/datepicker-in-modal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Datepicker 8 | 9 | 10 | 11 | 12 |
13 |

Datepicker in a Bootstrap modal

14 | 15 | 16 | 19 | 20 | 21 | 39 |
40 | 41 | 42 | 43 | 44 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/js/datepicker.ar-AE.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ar-AE'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['الأحد', 'الأثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], 11 | daysShort: ['أحد', 'أثنين', 'ثلاثاء', 'اربعاء', 'خميس', 'جمعة', 'سبت'], 12 | daysMin: ['أ', 'ث', 'ث', 'أ', 'خ', 'ج', 'س'], 13 | weekStart: 1, 14 | months: ['كانون الثاني', ' فبراير', 'مارس', 'أبريل', 'قد', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', ' اكتوبر', ' نوفمبر', 'ديسمبر'], 15 | monthsShort: ['كانون الثاني', ' فبراير', 'مارس', 'أبريل', 'قد', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', ' اكتوبر', ' نوفمبر', 'ديسمبر'], 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.ar-IQ.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ar-IQ'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['الأحد', 'الأثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], 11 | daysShort: ['أحد', 'أثنين', 'ثلاثاء', 'اربعاء', 'خميس', 'جمعة', 'سبت'], 12 | daysMin: ['أ', 'ث', 'ث', 'أ', 'خ', 'ج', 'س'], 13 | weekStart: 1, 14 | months: ['كانون الثاني', 'شباط', 'اذار', 'نيسان', 'ايار', 'حزيران', 'تموز', 'آب', 'ايلول', 'تشرين الاول', 'تشرين الثاني', 'كانون الاول'], 15 | monthsShort: ['كانون ٢', 'شباط', 'اذار', 'نيسان', 'ايار', 'حزيران', 'تموز', 'آب', 'ايلول', 'تشرين ١', 'تشرين ٢', 'كانون ١'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.ca-ES.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ca-ES'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['diumenge', 'dilluns', 'dimarts', 'dimecres', 'dijous', 'divendres', 'dissabte'], 11 | daysShort: ['dg.', 'dl.', 'dt.', 'dc.', 'dj.', 'dv.', 'ds.'], 12 | daysMin: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'], 13 | weekStart: 1, 14 | months: ['gener', 'febrer', 'març', 'abril', 'maig', 'juny', 'juliol', 'agost', 'setembre', 'octubre', 'novembre', 'desembre'], 15 | monthsShort: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.cs-CZ.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['cs-CZ'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'], 11 | daysShort: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'], 12 | daysMin: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'], 13 | weekStart: 1, 14 | months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'], 15 | // Used everywhere, but probably not grammar correct 16 | monthsShort: ['Led', 'Úno', 'Bře', 'Dub', 'Květ', 'Čvn', 'Čvc', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'] 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /docs/js/datepicker.da-DK.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['da-DK'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'], 11 | daysShort: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'], 12 | daysMin: ['Sø', 'Ma', 'Ti', 'On', 'To', 'Fr', 'Lø'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.de-AT.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['de-AT'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], 11 | daysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 12 | daysMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 13 | weekStart: 1, 14 | months: ['Jänner', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], 15 | monthsShort: ['Jän', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.de-DE.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['de-DE'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], 11 | daysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 12 | daysMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], 15 | monthsShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.el-GR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['el-GR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'], 11 | daysShort: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'], 12 | daysMin: ['Κ', 'Δ', 'Τ', 'Τ', 'Π', 'Π', 'Σ'], 13 | months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβρης', 'Οκτώβρης', 'Νοέμβρης', 'Δεκέμβρης'], 14 | monthsShort: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιούν', 'Ιούλ', 'Άυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /docs/js/datepicker.en-GB.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['en-GB'] = { 9 | format: 'dd/mm/yyyy' 10 | }; 11 | }))); 12 | -------------------------------------------------------------------------------- /docs/js/datepicker.en-US.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['en-US'] = { 9 | format: 'mm/dd/yyyy' 10 | }; 11 | }))); 12 | -------------------------------------------------------------------------------- /docs/js/datepicker.es-ES.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['es-ES'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], 11 | daysShort: ['Dom','Lun','Mar','Mie','Jue','Vie','Sab'], 12 | daysMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sa'], 13 | weekStart: 1, 14 | months: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], 15 | monthsShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.fi-FI.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['fi-FI'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Sunnuntai', 'Maanantai', 'Tiistai', 'Keskiviikko', 'Torstai', 'Perjantai', 'Lauantai'], 11 | daysShort: ['Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La'], 12 | daysMin: ['Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La'], 13 | weekStart: 1, 14 | months: ['Tammikuu', 'Helmikuu', 'Maaliskuu', 'Huhtikuu', 'Toukokuu', 'Kesäkuu', 'Heinäkuu', 'Elokuu', 'Syyskuu', 'Lokakuu', 'Marraskuu', 'Joulukuu'], 15 | monthsShort: ['Tammi', 'Helmi', 'Maalis', 'Huhti', 'Touko', 'Kesä', 'Heinä', 'Elo', 'Syys', 'Loka', 'Marras', 'Joulu'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.fr-FR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['fr-FR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], 11 | daysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], 12 | daysMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], 13 | weekStart: 1, 14 | months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], 15 | monthsShort: ['Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jun', 'Jui', 'Aoû', 'Sep', 'Oct', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.hu-HU.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['hu-HU'] = { 9 | format: 'yyyy. mm. dd.', 10 | days: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'], 11 | daysShort: ['vas', 'hé', 'ke', 'sze', 'csüt', 'pé', 'szo'], 12 | daysMin: ['V', 'H', 'K', 'Sz', 'Cs', 'P', 'Sz'], 13 | weekStart: 1, 14 | months: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], 15 | monthsShort: ['jan', 'feb', 'már', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szep', 'okt', 'nov', 'dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.is-IS.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['is-IS'] = { 9 | format: 'dd.mm.YYYY', 10 | // Capital letters are not used in day/month names 11 | days: ['sunnudagur', 'mánudagur', 'þriðjudagur', 'miðvikudagur', 'fimmtudagur', 'föstudagur', 'laugardagur'], 12 | daysShort: ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'], 13 | daysMin: ['Su', 'Má', 'Þr', 'Mi', 'Fi', 'Fö', 'La'], 14 | weekStart: 1, 15 | months: ['janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní', 'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember'], 16 | monthsShort: ['jan', 'feb', 'mar', 'apr', 'maí', 'jún', 'júl', 'ágú', 'sep', 'okt', 'nóv', 'des'] 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /docs/js/datepicker.it-IT.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['it-IT'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'], 11 | daysShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], 12 | daysMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'], 13 | weekStart: 1, 14 | months: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'], 15 | monthsShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.ja-JP.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ja-JP'] = { 9 | format: 'yyyy年mm月dd日', 10 | days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'], 11 | daysShort: ['日曜', '月曜', '火曜', '水曜', '木曜', '金曜', '土曜'], 12 | daysMin: ['日', '月', '火', '水', '木', '金', '土'], 13 | months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], 14 | monthsShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | yearSuffix: '年' 18 | }; 19 | }))); 20 | -------------------------------------------------------------------------------- /docs/js/datepicker.km-KH.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['km-KH'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['អាទិត្យ', 'ច័ន្ទ', ' អង្គារ', 'ពុធ', 'ព្រហស្បតិ៍', 'សុក្រ', 'សៅរ៍'], 11 | daysShort: ['អទ', 'ចន', 'អង', 'ពធ', 'ពហ', 'សក', 'សរ'], 12 | daysMin: ['អ', 'ច', 'អ', 'ព', 'ព្', 'ស', 'ស'], 13 | weekStart: 1, 14 | months: ['មករា', 'កុម្ភៈ', 'មីនា', 'មេសា', 'ឧសភា', 'មិថុនា', 'កក្កដា', 'សីហា', 'កញ្ញា', 'តុលា', 'វិច្ឆិកា', 'ធ្នូ'], 15 | monthsShort: ['មរ', 'កម', 'មន', 'មស', 'ឧស', 'មថ', 'កដ', 'សហ', 'កញ', 'តល', 'វឆ', 'ធ្ន'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.ko-KR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ko-KR'] = { 9 | format: 'yyyy. mm. dd', 10 | days: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'], 11 | daysShort: ['일', '월', '화', '수', '목', '금', '토'], 12 | daysMin: ['일', '월', '화', '수', '목', '금', '토'], 13 | months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], 14 | monthsShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | yearSuffix: '년' 18 | }; 19 | }))); 20 | -------------------------------------------------------------------------------- /docs/js/datepicker.lt-LT.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['lt-LT'] = { 9 | format: 'yyyy-mm-dd', 10 | days: ['Sekmadienis', 'Pirmadienis', 'Antradienis', 'Trečiadienis', 'Ketvirtadienis', 'Penktadienis', 'Šeštadienis'], 11 | daysShort: ['Sekm', 'Pirm', 'Antr', 'Treč', 'Ketv', 'Penkt', 'Šešt'], 12 | daysMin: ['Sk', 'Pr', 'An', 'Tr', 'Kt', 'Pn', 'Št'], 13 | weekStart: 1, 14 | months: ['Sausis', 'Vasaris', 'Kovas', 'Balandis', 'Gegužė', 'Birželis', 'Liepa', 'Rugpjūtis', 'Rugsėjis', 'Spalis', 'Lapkritis', 'Gruodis'], 15 | monthsShort: ['Sau', 'Vas', 'Kov', 'Bal', 'Geg', 'Bir', 'Lie', 'Rgp', 'Rgs', 'Spa', 'Lap', 'Gru'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.lv-LV.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['lv-LV'] = { 9 | format: 'YYYY-mm-dd', 10 | days: ['Svētdiena', 'Pirmdiena', 'Otrdiena', 'Trešdiena', 'Ceturtdiena', 'Piektdiena', 'Sestdiena'], 11 | daysShort: ['Sv', 'Pr', 'Ot', 'Tr', 'Ce', 'Pk', 'Se'], 12 | daysMin: ['Sv', 'Pr', 'Ot', 'Tr', 'Ce', 'Pk', 'Se'], 13 | months: ['Janvāris', 'Februāris', 'Marts', 'Aprīlis', 'Maijs', 'Jūnijs', 'Jūlijs', 'Augusts', 'Septembris', 'Oktobris', 'Novembris', 'Decembris'], 14 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jūn', 'Jūl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /docs/js/datepicker.nb-NO.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['nb-NO'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'], 11 | daysShort: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'], 12 | daysMin: ['Sø', 'Ma', 'Ti', 'On', 'To', 'Fr', 'Lø'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.nl-NL.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['nl-NL'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'], 11 | daysShort: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'], 12 | daysMin: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'], 13 | weekStart: 1, 14 | months: ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.oc-FR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['oc-FR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Dimenge', 'Diluns', 'Dimars', 'Dimècres', 'Dijòus', 'Divendres', 'Dissabte'], 11 | daysShort: ['Dg', 'Dl', 'Dm', 'Dc', 'Dj', 'Dv', 'Ds'], 12 | daysMin: ['dg', 'dl', 'dm', 'dc', 'dj', 'dv', 'ds'], 13 | weekStart: 1, 14 | months: ['Genièr', 'Febrièr', 'Març', 'Abrial', 'Mai', 'Junh', 'Julhet', 'Agost', 'Setembre', 'Octòbre', 'Novembre', 'Decembre'], 15 | monthsShort: ['Gen', 'Feb', 'Març', 'Abr', 'Mai', 'Junh', 'Julh', 'Ago', 'Set', 'Oct', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.pl-PL.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['pl-PL'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'], 11 | daysShort: ['Niedz', 'Pon', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'], 12 | // Used and correct are only daysShort, daysMin are just shorted to fit UI 13 | daysMin: ['Nie', 'Pon', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'], 14 | weekStart: 1, 15 | months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'], 16 | monthsShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'] 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /docs/js/datepicker.pt-BR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['pt-BR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'], 11 | daysShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'], 12 | daysMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'], 13 | months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], 14 | monthsShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'] 15 | }; 16 | }))); 17 | -------------------------------------------------------------------------------- /docs/js/datepicker.ro-RO.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ro-RO'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Duminică', 'Luni', 'Marți', 'Miercuri', 'Joi', 'Vineri', 'Sâmbată'], 11 | daysShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'], 12 | daysMin: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ'], 13 | weekStart: 1, 14 | months: ['Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie'], 15 | monthsShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Noi', 'Dec'], 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.ru-RU.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ru-RU'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'], 11 | daysShort: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 12 | daysMin: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 13 | months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], 14 | monthsShort: ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /docs/js/datepicker.si-LK.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['si-LK'] = { 9 | format: 'yyyy/mm/dd', 10 | days: ['ඉරිදා', 'සදුදා', 'අගහරුවදා', 'බදාදා', 'බ්‍රහස්පතින්දා', 'සිකුරාදා', 'සෙනසුරාදා'], 11 | daysShort: ['ඉරිදා', 'සදුදා', 'අග', 'බදාදා', 'බ්‍රහස්', 'සිකු', 'සෙන'], 12 | daysMin: ['ඉරිදා', 'සදුදා', 'අග', 'බදාදා', 'බ්‍රහස්', 'සිකු', 'සෙන'], 13 | weekStart: 1, 14 | months: ['ජනවාරි', 'පෙබරවාරි', 'මාර්තු', 'අප්‍රේල්', 'මැයි', 'ජුනි', 'ජූලි', 'අගෝස්තු', 'සැප්තැම්බර්', 'ඔක්තෝබර්', 'නොවැම්බර්', 'දෙසැම්බර්'], 15 | monthsShort: ['ජන', 'පෙබ', 'මාර්තු', 'අප්‍රේල්', 'මැයි', 'ජුනි', 'ජූලි', 'අගෝ', 'සැප්', 'ඔක්', 'නොවැ', 'දෙසැ'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.sk-SK.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['sk-SK'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Nedeľa', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'], 11 | daysShort: ['Ne', 'Po', 'Ut', 'St', 'Št', 'Pi', 'So'], 12 | daysMin: ['Ne', 'Po', 'Ut', 'St', 'Št', 'Pi', 'So'], 13 | weekStart: 1, 14 | months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún', 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.sl-SI.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['sl-SI'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Četrtek', 'Petek', 'Sobota'], 11 | daysShort: ['Ned', 'Pon', 'Tor', 'Sre', 'Čet', 'Pet', 'Sob'], 12 | daysMin: ['Ne', 'Po', 'To', 'Sr', 'Če', 'Pe', 'So'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.sv-SE.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['sv-SE'] = { 9 | format: 'yyyy-mm-dd', 10 | days: ['Söndag', 'Måndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lördag'], 11 | daysShort: ['Sön', 'Mån', 'Tis', 'Ons', 'Tor', 'Fre', 'Lör'], 12 | daysMin: ['Sö', 'Må', 'Ti', 'On', 'To', 'Fr', 'Lö'], 13 | weekStart: 1, 14 | months: ['Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.ta-TA.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ta-TA'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['ஞாயிற்றுக்கிழமை','திங்கட்கிழமை','செவ்வாய்கிழமை','புதன்கிழமை','வியாழக்கிழமை','வெள்ளிக்கிழமை','சனிக்கிழமை'], 11 | daysShort: ['ஞாயிறு','திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி'], 12 | daysMin: ['ஞா','தி','செ','பு','வி','வெ','ச'], 13 | weekStart: 1, 14 | months: ['ஜனவரி','பிப்ரவரி','மார்ச்','ஏப்ரல்','மே','ஜூன்','ஜூலை','ஆகஸ்ட்','செப்டெம்பர்','அக்டோபர்','நவம்பர்','டிசம்பர்'], 15 | monthsShort: ['ஜன', 'பிப்', 'மார்', 'ஏப்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக', 'செப்', 'அக்', 'நவ', 'டிச'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.th-TH.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['th-TH'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'], 11 | daysShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], 12 | daysMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], 13 | weekStart: 1, 14 | months: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'], 15 | monthsShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.','ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.tr-TR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['tr-TR'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'], 11 | daysShort: ['Paz', 'Pts', 'Sal', 'Çrş', 'Prş', 'Cum', 'Cts'], 12 | daysMin: ['P', 'P', 'S', 'Ç', 'P', 'C', 'C'], 13 | weekStart: 1, 14 | months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], 15 | monthsShort: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /docs/js/datepicker.ug-CN.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ug-CN'] = { 9 | format: 'yyyy-mm-dd', 10 | days: ['يەكشەنبە', 'دۈشەنبە', 'سەيشەنبە', 'چارشەنبە', 'پەيشەنبە', 'جۈمە', 'شەنبە'], 11 | daysShort: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], 12 | daysMin: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], 13 | months: ['يانۋار', 'فېۋىرال', 'مارت', 'ئاپرىل', 'ماي', 'ئىيۇن', 'ئىيۇل', 'ئاۋغۇست', 'سىنتەبىر', 'ئۆكتەبىر', 'نويابىر', 'دىكابىر'], 14 | monthsShort: ['يانۋار', 'فېۋىرال', 'مارت', 'ئاپرىل', 'ماي', 'ئىيۇن', 'ئىيۇل', 'ئاۋغۇست', 'سىنتەبىر', 'ئۆكتەبىر', 'نويابىر', 'دىكابىر'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /docs/js/datepicker.uk-UA.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['uk-UA'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'], 11 | daysShort: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 12 | daysMin: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 13 | months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'], 14 | monthsShort: ['Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /docs/js/datepicker.vi-VN.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['vi-VN'] = { 9 | days: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"], 10 | daysShort: ["CN", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"], 11 | daysMin: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"], 12 | months: ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"], 13 | monthsShort: ["Th1", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7", "Th8", "Th9", "Th10", "Th11", "Th12"], 14 | today: "Hôm nay", 15 | clear: "Xóa", 16 | format: "dd/mm/yyyy" 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /docs/js/datepicker.zh-CN.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['zh-CN'] = { 9 | format: 'yyyy年mm月dd日', 10 | days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], 11 | daysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], 12 | daysMin: ['日', '一', '二', '三', '四', '五', '六'], 13 | months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], 14 | monthsShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | yearSuffix: '年' 18 | }; 19 | }))); 20 | -------------------------------------------------------------------------------- /docs/js/main.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 'use strict'; 3 | 4 | var $date = $('.docs-date'); 5 | var $container = $('.docs-datepicker-container'); 6 | var $trigger = $('.docs-datepicker-trigger'); 7 | var options = { 8 | show: function (e) { 9 | console.log(e.type, e.namespace); 10 | }, 11 | hide: function (e) { 12 | console.log(e.type, e.namespace); 13 | }, 14 | pick: function (e) { 15 | console.log(e.type, e.namespace, e.view); 16 | } 17 | }; 18 | 19 | $date.on({ 20 | 'show.datepicker': function (e) { 21 | console.log(e.type, e.namespace); 22 | }, 23 | 'hide.datepicker': function (e) { 24 | console.log(e.type, e.namespace); 25 | }, 26 | 'pick.datepicker': function (e) { 27 | console.log(e.type, e.namespace, e.view); 28 | } 29 | }).datepicker(options); 30 | 31 | $('.docs-options, .docs-toggles').on('change', function (e) { 32 | var target = e.target; 33 | var $target = $(target); 34 | var name = $target.attr('name'); 35 | var value = target.type === 'checkbox' ? target.checked : $target.val(); 36 | var $optionContainer; 37 | 38 | switch (name) { 39 | case 'container': 40 | if (value) { 41 | value = $container; 42 | $container.show(); 43 | } else { 44 | $container.hide(); 45 | } 46 | 47 | break; 48 | 49 | case 'trigger': 50 | if (value) { 51 | value = $trigger; 52 | $trigger.prop('disabled', false); 53 | } else { 54 | $trigger.prop('disabled', true); 55 | } 56 | 57 | break; 58 | 59 | case 'inline': 60 | $optionContainer = $('input[name="container"]'); 61 | 62 | if (!$optionContainer.prop('checked')) { 63 | $optionContainer.click(); 64 | } 65 | 66 | break; 67 | 68 | case 'language': 69 | $('input[name="format"]').val($.fn.datepicker.languages[value].format); 70 | break; 71 | } 72 | 73 | options[name] = value; 74 | $date.datepicker('reset').datepicker('destroy').datepicker(options); 75 | }); 76 | 77 | $('.docs-actions').on('click', 'button', function (e) { 78 | var data = $(this).data(); 79 | var args = data.arguments || []; 80 | var result; 81 | 82 | e.stopPropagation(); 83 | 84 | if (data.method) { 85 | if (data.source) { 86 | $date.datepicker(data.method, $(data.source).val()); 87 | } else { 88 | result = $date.datepicker(data.method, args[0], args[1], args[2]); 89 | 90 | if (result && data.target) { 91 | $(data.target).val(result); 92 | } 93 | } 94 | } 95 | }); 96 | 97 | $('[data-toggle="datepicker"]').datepicker(); 98 | $('[data-toggle="tooltip"]').tooltip(); 99 | }); 100 | -------------------------------------------------------------------------------- /i18n/datepicker.ar-AE.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ar-AE'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['الأحد', 'الأثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], 11 | daysShort: ['أحد', 'أثنين', 'ثلاثاء', 'اربعاء', 'خميس', 'جمعة', 'سبت'], 12 | daysMin: ['أ', 'ث', 'ث', 'أ', 'خ', 'ج', 'س'], 13 | weekStart: 1, 14 | months: ['كانون الثاني', ' فبراير', 'مارس', 'أبريل', 'قد', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', ' اكتوبر', ' نوفمبر', 'ديسمبر'], 15 | monthsShort: ['كانون الثاني', ' فبراير', 'مارس', 'أبريل', 'قد', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', ' اكتوبر', ' نوفمبر', 'ديسمبر'], 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.ar-IQ.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ar-IQ'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['الأحد', 'الأثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], 11 | daysShort: ['أحد', 'أثنين', 'ثلاثاء', 'اربعاء', 'خميس', 'جمعة', 'سبت'], 12 | daysMin: ['أ', 'ث', 'ث', 'أ', 'خ', 'ج', 'س'], 13 | weekStart: 1, 14 | months: ['كانون الثاني', 'شباط', 'اذار', 'نيسان', 'ايار', 'حزيران', 'تموز', 'آب', 'ايلول', 'تشرين الاول', 'تشرين الثاني', 'كانون الاول'], 15 | monthsShort: ['كانون ٢', 'شباط', 'اذار', 'نيسان', 'ايار', 'حزيران', 'تموز', 'آب', 'ايلول', 'تشرين ١', 'تشرين ٢', 'كانون ١'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.ca-ES.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ca-ES'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['diumenge', 'dilluns', 'dimarts', 'dimecres', 'dijous', 'divendres', 'dissabte'], 11 | daysShort: ['dg.', 'dl.', 'dt.', 'dc.', 'dj.', 'dv.', 'ds.'], 12 | daysMin: ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'], 13 | weekStart: 1, 14 | months: ['gener', 'febrer', 'març', 'abril', 'maig', 'juny', 'juliol', 'agost', 'setembre', 'octubre', 'novembre', 'desembre'], 15 | monthsShort: ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.cs-CZ.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['cs-CZ'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'], 11 | daysShort: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'], 12 | daysMin: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'], 13 | weekStart: 1, 14 | months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'], 15 | // Used everywhere, but probably not grammar correct 16 | monthsShort: ['Led', 'Úno', 'Bře', 'Dub', 'Květ', 'Čvn', 'Čvc', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'] 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /i18n/datepicker.da-DK.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['da-DK'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'], 11 | daysShort: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'], 12 | daysMin: ['Sø', 'Ma', 'Ti', 'On', 'To', 'Fr', 'Lø'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.de-AT.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['de-AT'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], 11 | daysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 12 | daysMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 13 | weekStart: 1, 14 | months: ['Jänner', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], 15 | monthsShort: ['Jän', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.de-DE.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['de-DE'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], 11 | daysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 12 | daysMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], 15 | monthsShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.el-GR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['el-GR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'], 11 | daysShort: ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'], 12 | daysMin: ['Κ', 'Δ', 'Τ', 'Τ', 'Π', 'Π', 'Σ'], 13 | months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβρης', 'Οκτώβρης', 'Νοέμβρης', 'Δεκέμβρης'], 14 | monthsShort: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιούν', 'Ιούλ', 'Άυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /i18n/datepicker.en-GB.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['en-GB'] = { 9 | format: 'dd/mm/yyyy' 10 | }; 11 | }))); 12 | -------------------------------------------------------------------------------- /i18n/datepicker.en-US.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['en-US'] = { 9 | format: 'mm/dd/yyyy' 10 | }; 11 | }))); 12 | -------------------------------------------------------------------------------- /i18n/datepicker.es-ES.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['es-ES'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], 11 | daysShort: ['Dom','Lun','Mar','Mie','Jue','Vie','Sab'], 12 | daysMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sa'], 13 | weekStart: 1, 14 | months: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], 15 | monthsShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.fi-FI.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['fi-FI'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Sunnuntai', 'Maanantai', 'Tiistai', 'Keskiviikko', 'Torstai', 'Perjantai', 'Lauantai'], 11 | daysShort: ['Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La'], 12 | daysMin: ['Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La'], 13 | weekStart: 1, 14 | months: ['Tammikuu', 'Helmikuu', 'Maaliskuu', 'Huhtikuu', 'Toukokuu', 'Kesäkuu', 'Heinäkuu', 'Elokuu', 'Syyskuu', 'Lokakuu', 'Marraskuu', 'Joulukuu'], 15 | monthsShort: ['Tammi', 'Helmi', 'Maalis', 'Huhti', 'Touko', 'Kesä', 'Heinä', 'Elo', 'Syys', 'Loka', 'Marras', 'Joulu'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.fr-FR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['fr-FR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], 11 | daysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'], 12 | daysMin: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'], 13 | weekStart: 1, 14 | months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], 15 | monthsShort: ['Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jun', 'Jui', 'Aoû', 'Sep', 'Oct', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.he-IL.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['he-IL'] = { 9 | format: 'dd/mm/YYYY', 10 | days: ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'], 11 | daysShort: ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש'], 12 | daysMin: ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש'], 13 | months: ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'], 14 | monthsShort: ['ינ', 'פב', 'מרץ', 'אפר', 'מאי', 'יונ', 'יול', 'אוג', 'ספט', 'אוק', 'נוב', 'דצ'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /i18n/datepicker.hu-HU.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['hu-HU'] = { 9 | format: 'yyyy. mm. dd.', 10 | days: ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'], 11 | daysShort: ['vas', 'hé', 'ke', 'sze', 'csüt', 'pé', 'szo'], 12 | daysMin: ['V', 'H', 'K', 'Sz', 'Cs', 'P', 'Sz'], 13 | weekStart: 1, 14 | months: ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], 15 | monthsShort: ['jan', 'feb', 'már', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szep', 'okt', 'nov', 'dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.is-IS.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['is-IS'] = { 9 | format: 'dd.mm.YYYY', 10 | // Capital letters are not used in day/month names 11 | days: ['sunnudagur', 'mánudagur', 'þriðjudagur', 'miðvikudagur', 'fimmtudagur', 'föstudagur', 'laugardagur'], 12 | daysShort: ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'], 13 | daysMin: ['Su', 'Má', 'Þr', 'Mi', 'Fi', 'Fö', 'La'], 14 | weekStart: 1, 15 | months: ['janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní', 'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember'], 16 | monthsShort: ['jan', 'feb', 'mar', 'apr', 'maí', 'jún', 'júl', 'ágú', 'sep', 'okt', 'nóv', 'des'] 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /i18n/datepicker.it-IT.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['it-IT'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'], 11 | daysShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], 12 | daysMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'], 13 | weekStart: 1, 14 | months: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'], 15 | monthsShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.ja-JP.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ja-JP'] = { 9 | format: 'yyyy年mm月dd日', 10 | days: ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'], 11 | daysShort: ['日曜', '月曜', '火曜', '水曜', '木曜', '金曜', '土曜'], 12 | daysMin: ['日', '月', '火', '水', '木', '金', '土'], 13 | months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], 14 | monthsShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | yearSuffix: '年' 18 | }; 19 | }))); 20 | -------------------------------------------------------------------------------- /i18n/datepicker.km-KH.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['km-KH'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['អាទិត្យ', 'ច័ន្ទ', ' អង្គារ', 'ពុធ', 'ព្រហស្បតិ៍', 'សុក្រ', 'សៅរ៍'], 11 | daysShort: ['អទ', 'ចន', 'អង', 'ពធ', 'ពហ', 'សក', 'សរ'], 12 | daysMin: ['អ', 'ច', 'អ', 'ព', 'ព្', 'ស', 'ស'], 13 | weekStart: 1, 14 | months: ['មករា', 'កុម្ភៈ', 'មីនា', 'មេសា', 'ឧសភា', 'មិថុនា', 'កក្កដា', 'សីហា', 'កញ្ញា', 'តុលា', 'វិច្ឆិកា', 'ធ្នូ'], 15 | monthsShort: ['មរ', 'កម', 'មន', 'មស', 'ឧស', 'មថ', 'កដ', 'សហ', 'កញ', 'តល', 'វឆ', 'ធ្ន'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.ko-KR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ko-KR'] = { 9 | format: 'yyyy. mm. dd', 10 | days: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'], 11 | daysShort: ['일', '월', '화', '수', '목', '금', '토'], 12 | daysMin: ['일', '월', '화', '수', '목', '금', '토'], 13 | months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], 14 | monthsShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | yearSuffix: '년' 18 | }; 19 | }))); 20 | -------------------------------------------------------------------------------- /i18n/datepicker.lt-LT.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['lt-LT'] = { 9 | format: 'yyyy-mm-dd', 10 | days: ['Sekmadienis', 'Pirmadienis', 'Antradienis', 'Trečiadienis', 'Ketvirtadienis', 'Penktadienis', 'Šeštadienis'], 11 | daysShort: ['Sekm', 'Pirm', 'Antr', 'Treč', 'Ketv', 'Penkt', 'Šešt'], 12 | daysMin: ['Sk', 'Pr', 'An', 'Tr', 'Kt', 'Pn', 'Št'], 13 | weekStart: 1, 14 | months: ['Sausis', 'Vasaris', 'Kovas', 'Balandis', 'Gegužė', 'Birželis', 'Liepa', 'Rugpjūtis', 'Rugsėjis', 'Spalis', 'Lapkritis', 'Gruodis'], 15 | monthsShort: ['Sau', 'Vas', 'Kov', 'Bal', 'Geg', 'Bir', 'Lie', 'Rgp', 'Rgs', 'Spa', 'Lap', 'Gru'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.lv-LV.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['lv-LV'] = { 9 | format: 'YYYY-mm-dd', 10 | days: ['Svētdiena', 'Pirmdiena', 'Otrdiena', 'Trešdiena', 'Ceturtdiena', 'Piektdiena', 'Sestdiena'], 11 | daysShort: ['Sv', 'Pr', 'Ot', 'Tr', 'Ce', 'Pk', 'Se'], 12 | daysMin: ['Sv', 'Pr', 'Ot', 'Tr', 'Ce', 'Pk', 'Se'], 13 | months: ['Janvāris', 'Februāris', 'Marts', 'Aprīlis', 'Maijs', 'Jūnijs', 'Jūlijs', 'Augusts', 'Septembris', 'Oktobris', 'Novembris', 'Decembris'], 14 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jūn', 'Jūl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /i18n/datepicker.nb-NO.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['nb-NO'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'], 11 | daysShort: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'], 12 | daysMin: ['Sø', 'Ma', 'Ti', 'On', 'To', 'Fr', 'Lø'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.nl-NL.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['nl-NL'] = { 9 | format: 'dd-mm-yyyy', 10 | days: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'], 11 | daysShort: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'], 12 | daysMin: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'], 13 | weekStart: 1, 14 | months: ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.oc-FR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['oc-FR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Dimenge', 'Diluns', 'Dimars', 'Dimècres', 'Dijòus', 'Divendres', 'Dissabte'], 11 | daysShort: ['Dg', 'Dl', 'Dm', 'Dc', 'Dj', 'Dv', 'Ds'], 12 | daysMin: ['dg', 'dl', 'dm', 'dc', 'dj', 'dv', 'ds'], 13 | weekStart: 1, 14 | months: ['Genièr', 'Febrièr', 'Març', 'Abrial', 'Mai', 'Junh', 'Julhet', 'Agost', 'Setembre', 'Octòbre', 'Novembre', 'Decembre'], 15 | monthsShort: ['Gen', 'Feb', 'Març', 'Abr', 'Mai', 'Junh', 'Julh', 'Ago', 'Set', 'Oct', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.pl-PL.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['pl-PL'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'], 11 | daysShort: ['Niedz', 'Pon', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'], 12 | // Used and correct are only daysShort, daysMin are just shorted to fit UI 13 | daysMin: ['Nie', 'Pon', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'], 14 | weekStart: 1, 15 | months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'], 16 | monthsShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'] 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /i18n/datepicker.pt-BR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['pt-BR'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'], 11 | daysShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'], 12 | daysMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'], 13 | months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], 14 | monthsShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'] 15 | }; 16 | }))); 17 | -------------------------------------------------------------------------------- /i18n/datepicker.ro-RO.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ro-RO'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Duminică', 'Luni', 'Marți', 'Miercuri', 'Joi', 'Vineri', 'Sâmbată'], 11 | daysShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'], 12 | daysMin: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sâ'], 13 | weekStart: 1, 14 | months: ['Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie'], 15 | monthsShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Noi', 'Dec'], 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.ru-RU.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ru-RU'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'], 11 | daysShort: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 12 | daysMin: ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 13 | months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], 14 | monthsShort: ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /i18n/datepicker.si-LK.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['si-LK'] = { 9 | format: 'yyyy/mm/dd', 10 | days: ['ඉරිදා', 'සදුදා', 'අගහරුවදා', 'බදාදා', 'බ්‍රහස්පතින්දා', 'සිකුරාදා', 'සෙනසුරාදා'], 11 | daysShort: ['ඉරිදා', 'සදුදා', 'අග', 'බදාදා', 'බ්‍රහස්', 'සිකු', 'සෙන'], 12 | daysMin: ['ඉරිදා', 'සදුදා', 'අග', 'බදාදා', 'බ්‍රහස්', 'සිකු', 'සෙන'], 13 | weekStart: 1, 14 | months: ['ජනවාරි', 'පෙබරවාරි', 'මාර්තු', 'අප්‍රේල්', 'මැයි', 'ජුනි', 'ජූලි', 'අගෝස්තු', 'සැප්තැම්බර්', 'ඔක්තෝබර්', 'නොවැම්බර්', 'දෙසැම්බර්'], 15 | monthsShort: ['ජන', 'පෙබ', 'මාර්තු', 'අප්‍රේල්', 'මැයි', 'ජුනි', 'ජූලි', 'අගෝ', 'සැප්', 'ඔක්', 'නොවැ', 'දෙසැ'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.sk-SK.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['sk-SK'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Nedeľa', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'], 11 | daysShort: ['Ne', 'Po', 'Ut', 'St', 'Št', 'Pi', 'So'], 12 | daysMin: ['Ne', 'Po', 'Ut', 'St', 'Št', 'Pi', 'So'], 13 | weekStart: 1, 14 | months: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún', 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.sl-SI.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['sl-SI'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Četrtek', 'Petek', 'Sobota'], 11 | daysShort: ['Ned', 'Pon', 'Tor', 'Sre', 'Čet', 'Pet', 'Sob'], 12 | daysMin: ['Ne', 'Po', 'To', 'Sr', 'Če', 'Pe', 'So'], 13 | weekStart: 1, 14 | months: ['Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.sv-SE.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['sv-SE'] = { 9 | format: 'yyyy-mm-dd', 10 | days: ['Söndag', 'Måndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lördag'], 11 | daysShort: ['Sön', 'Mån', 'Tis', 'Ons', 'Tor', 'Fre', 'Lör'], 12 | daysMin: ['Sö', 'Må', 'Ti', 'On', 'To', 'Fr', 'Lö'], 13 | weekStart: 1, 14 | months: ['Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December'], 15 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.ta-TA.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ta-TA'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['ஞாயிற்றுக்கிழமை','திங்கட்கிழமை','செவ்வாய்கிழமை','புதன்கிழமை','வியாழக்கிழமை','வெள்ளிக்கிழமை','சனிக்கிழமை'], 11 | daysShort: ['ஞாயிறு','திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி'], 12 | daysMin: ['ஞா','தி','செ','பு','வி','வெ','ச'], 13 | weekStart: 1, 14 | months: ['ஜனவரி','பிப்ரவரி','மார்ச்','ஏப்ரல்','மே','ஜூன்','ஜூலை','ஆகஸ்ட்','செப்டெம்பர்','அக்டோபர்','நவம்பர்','டிசம்பர்'], 15 | monthsShort: ['ஜன', 'பிப்', 'மார்', 'ஏப்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக', 'செப்', 'அக்', 'நவ', 'டிச'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.th-TH.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['th-TH'] = { 9 | format: 'dd/mm/yyyy', 10 | days: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'], 11 | daysShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], 12 | daysMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'], 13 | weekStart: 1, 14 | months: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'], 15 | monthsShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.','ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.tr-TR.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['tr-TR'] = { 9 | format: 'dd.mm.yyyy', 10 | days: ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'], 11 | daysShort: ['Paz', 'Pts', 'Sal', 'Çrş', 'Prş', 'Cum', 'Cts'], 12 | daysMin: ['P', 'P', 'S', 'Ç', 'P', 'C', 'C'], 13 | weekStart: 1, 14 | months: ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], 15 | monthsShort: ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'] 16 | }; 17 | }))); 18 | -------------------------------------------------------------------------------- /i18n/datepicker.ug-CN.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['ug-CN'] = { 9 | format: 'yyyy-mm-dd', 10 | days: ['يەكشەنبە', 'دۈشەنبە', 'سەيشەنبە', 'چارشەنبە', 'پەيشەنبە', 'جۈمە', 'شەنبە'], 11 | daysShort: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], 12 | daysMin: ['ي', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], 13 | months: ['يانۋار', 'فېۋىرال', 'مارت', 'ئاپرىل', 'ماي', 'ئىيۇن', 'ئىيۇل', 'ئاۋغۇست', 'سىنتەبىر', 'ئۆكتەبىر', 'نويابىر', 'دىكابىر'], 14 | monthsShort: ['يانۋار', 'فېۋىرال', 'مارت', 'ئاپرىل', 'ماي', 'ئىيۇن', 'ئىيۇل', 'ئاۋغۇست', 'سىنتەبىر', 'ئۆكتەبىر', 'نويابىر', 'دىكابىر'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /i18n/datepicker.uk-UA.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['uk-UA'] = { 9 | format: 'dd.mm.YYYY', 10 | days: ['Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'], 11 | daysShort: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 12 | daysMin: ['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'], 13 | months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'], 14 | monthsShort: ['Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'], 15 | weekStart: 1, 16 | startView: 0, 17 | yearFirst: false, 18 | yearSuffix: '' 19 | }; 20 | }))); 21 | -------------------------------------------------------------------------------- /i18n/datepicker.vi-VN.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['vi-VN'] = { 9 | days: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"], 10 | daysShort: ["CN", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"], 11 | daysMin: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"], 12 | months: ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"], 13 | monthsShort: ["Th1", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7", "Th8", "Th9", "Th10", "Th11", "Th12"], 14 | today: "Hôm nay", 15 | clear: "Xóa", 16 | format: "dd/mm/yyyy" 17 | }; 18 | }))); 19 | -------------------------------------------------------------------------------- /i18n/datepicker.zh-CN.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) : 3 | typeof define === 'function' && define.amd ? define(['jquery'], factory) : 4 | (factory(global.jQuery)); 5 | }(this, (function ($) { 6 | 'use strict'; 7 | 8 | $.fn.datepicker.languages['zh-CN'] = { 9 | format: 'yyyy年mm月dd日', 10 | days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], 11 | daysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], 12 | daysMin: ['日', '一', '二', '三', '四', '五', '六'], 13 | months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], 14 | monthsShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], 15 | weekStart: 1, 16 | yearFirst: true, 17 | yearSuffix: '年' 18 | }; 19 | }))); 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@chenfengyuan/datepicker", 3 | "version": "1.0.10", 4 | "description": "A simple jQuery datepicker plugin.", 5 | "main": "dist/datepicker.common.js", 6 | "module": "dist/datepicker.esm.js", 7 | "browser": "dist/datepicker.js", 8 | "style": "dist/datepicker.css", 9 | "files": [ 10 | "src", 11 | "dist", 12 | "i18n" 13 | ], 14 | "scripts": { 15 | "build": "npm run build:css && npm run build:js", 16 | "build:css": "postcss src/index.css -o dist/datepicker.css --no-map", 17 | "build:js": "rollup -c", 18 | "clear": "del-cli dist", 19 | "compress": "npm run compress:css && npm run compress:js", 20 | "compress:css": "postcss dist/datepicker.css -u cssnano -o dist/datepicker.min.css --no-map", 21 | "compress:js": "uglifyjs dist/datepicker.js -o dist/datepicker.min.js -c -m --comments /^!/", 22 | "copy": "npm run copy:css && npm run copy:i18n", 23 | "copy:css": "cpy dist/datepicker.css docs/css/", 24 | "copy:i18n": "cpy i18n/* docs/js", 25 | "lint": "npm run lint:js && npm run lint:css", 26 | "lint:css": "stylelint {src,docs,examples}/**/*.{css,scss,html} --fix", 27 | "lint:js": "eslint src *.js --fix", 28 | "release": "npm run clear && npm run lint && npm run build && npm run compress && npm run copy && npm test", 29 | "start": "npm-run-all --parallel watch:*", 30 | "test": "node-qunit-phantomjs test/index.html --timeout 10", 31 | "watch:css": "postcss src/index.css -o docs/css/datepicker.css -m -w", 32 | "watch:js": "rollup -c -m -w" 33 | }, 34 | "repository": { 35 | "type": "git", 36 | "url": "git+https://github.com/fengyuanchen/datepicker.git" 37 | }, 38 | "keywords": [ 39 | "date", 40 | "picker", 41 | "datepicker", 42 | "jquery", 43 | "plugin", 44 | "jquery-plugin", 45 | "html", 46 | "css", 47 | "javascript", 48 | "front-end", 49 | "web" 50 | ], 51 | "author": { 52 | "name": "Chen Fengyuan", 53 | "url": "https://chenfengyuan.com/" 54 | }, 55 | "license": "MIT", 56 | "bugs": { 57 | "url": "https://github.com/fengyuanchen/datepicker/issues" 58 | }, 59 | "homepage": "https://fengyuanchen.github.io/datepicker", 60 | "devDependencies": { 61 | "@babel/core": "^7.11.6", 62 | "@babel/preset-env": "^7.11.5", 63 | "@commitlint/cli": "^11.0.0", 64 | "@commitlint/config-conventional": "^11.0.0", 65 | "cpy-cli": "^3.1.1", 66 | "create-banner": "^1.0.0", 67 | "cssnano": "^4.1.10", 68 | "del-cli": "^3.0.1", 69 | "eslint": "^7.10.0", 70 | "eslint-config-airbnb-base": "^14.2.0", 71 | "eslint-plugin-import": "^2.22.1", 72 | "husky": "^4.3.0", 73 | "jquery": "^3.5.1", 74 | "lint-staged": "^10.4.0", 75 | "node-qunit-phantomjs": "^2.1.1", 76 | "npm-run-all": "^4.1.5", 77 | "postcss-cli": "^8.0.0", 78 | "postcss-header": "^3.0.1", 79 | "postcss-import": "^12.0.1", 80 | "postcss-preset-env": "^6.7.0", 81 | "rollup": "^2.28.2", 82 | "rollup-plugin-babel": "^4.3.3", 83 | "rollup-plugin-commonjs": "^10.1.0", 84 | "rollup-plugin-node-resolve": "^5.2.0", 85 | "stylelint": "^13.7.2", 86 | "stylelint-config-standard": "^20.0.0", 87 | "stylelint-order": "^4.1.0", 88 | "uglify-js": "^3.11.0" 89 | }, 90 | "peerDependencies": { 91 | "jquery": ">=1.9.1" 92 | }, 93 | "publishConfig": { 94 | "access": "public" 95 | }, 96 | "browserslist": [ 97 | "last 2 versions", 98 | "> 1%", 99 | "not ie <= 8" 100 | ], 101 | "commitlint": { 102 | "extends": [ 103 | "@commitlint/config-conventional" 104 | ] 105 | }, 106 | "husky": { 107 | "hooks": { 108 | "pre-commit": "lint-staged", 109 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 110 | } 111 | }, 112 | "lint-staged": { 113 | "{src,test}/**/*.js|*.conf*.js": [ 114 | "eslint --fix", 115 | "git add" 116 | ], 117 | "{src,docs}/**/*.{css,scss,html}": [ 118 | "stylelint --fix", 119 | "git add" 120 | ] 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | const rollupConfig = require('./rollup.config'); 2 | 3 | module.exports = { 4 | plugins: { 5 | 'postcss-import': {}, 6 | 'postcss-preset-env': { 7 | stage: 3, 8 | features: { 9 | 'nesting-rules': true, 10 | }, 11 | }, 12 | 'postcss-header': { 13 | header: rollupConfig.output[0].banner, 14 | }, 15 | stylelint: { 16 | fix: true, 17 | }, 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | const babel = require('rollup-plugin-babel'); 2 | const commonjs = require('rollup-plugin-commonjs'); 3 | const createBanner = require('create-banner'); 4 | const nodeResolve = require('rollup-plugin-node-resolve'); 5 | const pkg = require('./package'); 6 | 7 | pkg.name = pkg.name.replace(/^.+\//, ''); 8 | 9 | const banner = createBanner({ 10 | case: 'PascalCase', 11 | data: { 12 | year: '2014-present', 13 | }, 14 | }); 15 | 16 | module.exports = { 17 | input: 'src/index.js', 18 | output: [ 19 | { 20 | banner, 21 | file: `dist/${pkg.name}.js`, 22 | format: 'umd', 23 | globals: { 24 | jquery: 'jQuery', 25 | }, 26 | }, 27 | { 28 | banner, 29 | file: `dist/${pkg.name}.common.js`, 30 | format: 'cjs', 31 | exports: 'auto', 32 | }, 33 | { 34 | banner, 35 | file: `dist/${pkg.name}.esm.js`, 36 | format: 'esm', 37 | }, 38 | { 39 | banner, 40 | file: `docs/js/${pkg.name}.js`, 41 | format: 'umd', 42 | globals: { 43 | jquery: 'jQuery', 44 | }, 45 | }, 46 | ], 47 | external: ['jquery'], 48 | plugins: [ 49 | nodeResolve(), 50 | commonjs(), 51 | babel(), 52 | ], 53 | }; 54 | -------------------------------------------------------------------------------- /src/css/datepicker.css: -------------------------------------------------------------------------------- 1 | .datepicker-container { 2 | background-color: #fff; 3 | direction: ltr; 4 | font-size: 12px; 5 | left: 0; 6 | line-height: 30px; 7 | position: fixed; 8 | -webkit-tap-highlight-color: transparent; 9 | top: 0; 10 | touch-action: none; 11 | -webkit-touch-callout: none; 12 | user-select: none; 13 | width: 210px; 14 | z-index: -1; 15 | 16 | &::before, 17 | &::after { 18 | border: 5px solid transparent; 19 | content: " "; 20 | display: block; 21 | height: 0; 22 | position: absolute; 23 | width: 0; 24 | } 25 | } 26 | 27 | .datepicker-dropdown { 28 | border: 1px solid #ccc; 29 | box-shadow: 0 3px 6px #ccc; 30 | box-sizing: content-box; 31 | position: absolute; 32 | z-index: 1; 33 | } 34 | 35 | .datepicker-inline { 36 | position: static; 37 | } 38 | 39 | .datepicker-top-left, 40 | .datepicker-top-right { 41 | border-top-color: #39f; 42 | 43 | &::before, 44 | &::after { 45 | border-top: 0; 46 | left: 10px; 47 | top: -5px; 48 | } 49 | 50 | &::before { 51 | border-bottom-color: #39f; 52 | } 53 | 54 | &::after { 55 | border-bottom-color: #fff; 56 | top: -4px; 57 | } 58 | } 59 | 60 | .datepicker-bottom-left, 61 | .datepicker-bottom-right { 62 | border-bottom-color: #39f; 63 | 64 | &::before, 65 | &::after { 66 | border-bottom: 0; 67 | bottom: -5px; 68 | left: 10px; 69 | } 70 | 71 | &::before { 72 | border-top-color: #39f; 73 | } 74 | 75 | &::after { 76 | border-top-color: #fff; 77 | bottom: -4px; 78 | } 79 | } 80 | 81 | .datepicker-top-right, 82 | .datepicker-bottom-right { 83 | &::before, 84 | &::after { 85 | left: auto; 86 | right: 10px; 87 | } 88 | } 89 | 90 | .datepicker-panel { 91 | & > ul { 92 | margin: 0; 93 | padding: 0; 94 | width: 102%; 95 | 96 | &::before, 97 | &::after { 98 | content: " "; 99 | display: table; 100 | } 101 | 102 | &::after { 103 | clear: both; 104 | } 105 | 106 | & > li { 107 | background-color: #fff; 108 | cursor: pointer; 109 | float: left; 110 | height: 30px; 111 | list-style: none; 112 | margin: 0; 113 | padding: 0; 114 | text-align: center; 115 | width: 30px; 116 | 117 | &:hover { 118 | background-color: rgb(229, 242, 255); 119 | } 120 | 121 | &.muted, 122 | &.muted:hover { 123 | color: #999; 124 | } 125 | 126 | &.highlighted { 127 | background-color: rgb(229, 242, 255); 128 | 129 | &:hover { 130 | background-color: rgb(204, 229, 255); 131 | } 132 | } 133 | 134 | &.picked, 135 | &.picked:hover { 136 | color: #39f; 137 | } 138 | 139 | &.disabled, 140 | &.disabled:hover { 141 | background-color: #fff; 142 | color: #ccc; 143 | cursor: default; 144 | 145 | &.highlighted { 146 | background-color: rgb(229, 242, 255); 147 | } 148 | } 149 | 150 | &[data-view="years prev"], 151 | &[data-view="year prev"], 152 | &[data-view="month prev"], 153 | &[data-view="years next"], 154 | &[data-view="year next"], 155 | &[data-view="month next"], 156 | &[data-view="next"] { 157 | font-size: 18px; 158 | } 159 | 160 | &[data-view="years current"], 161 | &[data-view="year current"], 162 | &[data-view="month current"] { 163 | width: 150px; 164 | } 165 | } 166 | 167 | &[data-view="years"], 168 | &[data-view="months"] { 169 | & > li { 170 | height: 52.5px; 171 | line-height: 52.5px; 172 | width: 52.5px; 173 | } 174 | } 175 | 176 | &[data-view="week"] { 177 | & > li, 178 | & > li:hover { 179 | background-color: #fff; 180 | cursor: default; 181 | } 182 | } 183 | } 184 | } 185 | 186 | .datepicker-hide { 187 | display: none; 188 | } 189 | -------------------------------------------------------------------------------- /src/css/datepicker.scss: -------------------------------------------------------------------------------- 1 | .datepicker { 2 | &-container { 3 | background-color: #fff; 4 | direction: ltr; 5 | font-size: 12px; 6 | left: 0; 7 | line-height: 30px; 8 | position: fixed; 9 | -webkit-tap-highlight-color: transparent; 10 | top: 0; 11 | touch-action: none; 12 | -webkit-touch-callout: none; 13 | user-select: none; 14 | width: 210px; 15 | z-index: -1; 16 | 17 | &::before, 18 | &::after { 19 | border: 5px solid transparent; 20 | content: " "; 21 | display: block; 22 | height: 0; 23 | position: absolute; 24 | width: 0; 25 | } 26 | } 27 | 28 | &-dropdown { 29 | border: 1px solid #ccc; 30 | box-shadow: 0 3px 6px #ccc; 31 | box-sizing: content-box; 32 | position: absolute; 33 | z-index: 1; 34 | } 35 | 36 | &-inline { 37 | position: static; 38 | } 39 | 40 | &-top-left, 41 | &-top-right { 42 | border-top-color: #39f; 43 | 44 | &::before, 45 | &::after { 46 | border-top: 0; 47 | left: 10px; 48 | top: -5px; 49 | } 50 | 51 | &::before { 52 | border-bottom-color: #39f; 53 | } 54 | 55 | &::after { 56 | border-bottom-color: #fff; 57 | top: -4px; 58 | } 59 | } 60 | 61 | &-bottom-left, 62 | &-bottom-right { 63 | border-bottom-color: #39f; 64 | 65 | &::before, 66 | &::after { 67 | border-bottom: 0; 68 | bottom: -5px; 69 | left: 10px; 70 | } 71 | 72 | &::before { 73 | border-top-color: #39f; 74 | } 75 | 76 | &::after { 77 | border-top-color: #fff; 78 | bottom: -4px; 79 | } 80 | } 81 | 82 | &-top-right, 83 | &-bottom-right { 84 | &::before, 85 | &::after { 86 | left: auto; 87 | right: 10px; 88 | } 89 | } 90 | 91 | &-panel { 92 | > ul { 93 | margin: 0; 94 | padding: 0; 95 | width: 102%; 96 | 97 | &::before, 98 | &::after { 99 | content: " "; 100 | display: table; 101 | } 102 | 103 | &::after { 104 | clear: both; 105 | } 106 | 107 | > li { 108 | background-color: #fff; 109 | cursor: pointer; 110 | float: left; 111 | height: 30px; 112 | list-style: none; 113 | margin: 0; 114 | padding: 0; 115 | text-align: center; 116 | width: 30px; 117 | 118 | &:hover { 119 | background-color: rgb(229, 242, 255); 120 | } 121 | 122 | &.muted, 123 | &.muted:hover { 124 | color: #999; 125 | } 126 | 127 | &.highlighted { 128 | background-color: rgb(229, 242, 255); 129 | 130 | &:hover { 131 | background-color: rgb(204, 229, 255); 132 | } 133 | } 134 | 135 | &.picked, 136 | &.picked:hover { 137 | color: #39f; 138 | } 139 | 140 | &.disabled, 141 | &.disabled:hover { 142 | background-color: #fff; 143 | color: #ccc; 144 | cursor: default; 145 | 146 | &.highlighted { 147 | background-color: rgb(229, 242, 255); 148 | } 149 | } 150 | 151 | &[data-view="years prev"], 152 | &[data-view="year prev"], 153 | &[data-view="month prev"], 154 | &[data-view="years next"], 155 | &[data-view="year next"], 156 | &[data-view="month next"], 157 | &[data-view="next"] { 158 | font-size: 18px; 159 | } 160 | 161 | &[data-view="years current"], 162 | &[data-view="year current"], 163 | &[data-view="month current"] { 164 | width: 150px; 165 | } 166 | } 167 | 168 | &[data-view="years"], 169 | &[data-view="months"] { 170 | > li { 171 | height: 52.5px; 172 | line-height: 52.5px; 173 | width: 52.5px; 174 | } 175 | } 176 | 177 | &[data-view="week"] { 178 | > li, 179 | > li:hover { 180 | background-color: #fff; 181 | cursor: default; 182 | } 183 | } 184 | } 185 | } 186 | 187 | &-hide { 188 | display: none; 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @import './css/datepicker.css'; 2 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import Datepicker from './js/datepicker'; 3 | import { 4 | NAMESPACE, 5 | LANGUAGES, 6 | } from './js/constants'; 7 | import { 8 | isString, 9 | isUndefined, 10 | } from './js/utilities'; 11 | 12 | if ($.fn) { 13 | const AnotherDatepicker = $.fn.datepicker; 14 | 15 | $.fn.datepicker = function jQueryDatepicker(option, ...args) { 16 | let result; 17 | 18 | this.each((i, element) => { 19 | const $element = $(element); 20 | const isDestroy = option === 'destroy'; 21 | let datepicker = $element.data(NAMESPACE); 22 | 23 | if (!datepicker) { 24 | if (isDestroy) { 25 | return; 26 | } 27 | 28 | const options = $.extend({}, $element.data(), $.isPlainObject(option) && option); 29 | 30 | datepicker = new Datepicker(element, options); 31 | $element.data(NAMESPACE, datepicker); 32 | } 33 | 34 | if (isString(option)) { 35 | const fn = datepicker[option]; 36 | 37 | if ($.isFunction(fn)) { 38 | result = fn.apply(datepicker, args); 39 | 40 | if (isDestroy) { 41 | $element.removeData(NAMESPACE); 42 | } 43 | } 44 | } 45 | }); 46 | 47 | return !isUndefined(result) ? result : this; 48 | }; 49 | 50 | $.fn.datepicker.Constructor = Datepicker; 51 | $.fn.datepicker.languages = LANGUAGES; 52 | $.fn.datepicker.setDefaults = Datepicker.setDefaults; 53 | $.fn.datepicker.noConflict = function noConflict() { 54 | $.fn.datepicker = AnotherDatepicker; 55 | return this; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /src/index.scss: -------------------------------------------------------------------------------- 1 | @import './css/datepicker.scss'; 2 | -------------------------------------------------------------------------------- /src/js/constants.js: -------------------------------------------------------------------------------- 1 | export const IS_BROWSER = typeof window !== 'undefined'; 2 | export const WINDOW = IS_BROWSER ? window : {}; 3 | export const IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false; 4 | export const NAMESPACE = 'datepicker'; 5 | export const EVENT_CLICK = `click.${NAMESPACE}`; 6 | export const EVENT_FOCUS = `focus.${NAMESPACE}`; 7 | export const EVENT_HIDE = `hide.${NAMESPACE}`; 8 | export const EVENT_KEYUP = `keyup.${NAMESPACE}`; 9 | export const EVENT_PICK = `pick.${NAMESPACE}`; 10 | export const EVENT_RESIZE = `resize.${NAMESPACE}`; 11 | export const EVENT_SCROLL = `scroll.${NAMESPACE}`; 12 | export const EVENT_SHOW = `show.${NAMESPACE}`; 13 | export const EVENT_TOUCH_START = `touchstart.${NAMESPACE}`; 14 | export const CLASS_HIDE = `${NAMESPACE}-hide`; 15 | export const LANGUAGES = {}; 16 | export const VIEWS = { 17 | DAYS: 0, 18 | MONTHS: 1, 19 | YEARS: 2, 20 | }; 21 | -------------------------------------------------------------------------------- /src/js/datepicker.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import DEFAULTS from './defaults'; 3 | import methods from './methods'; 4 | import handlers from './handlers'; 5 | import render from './render'; 6 | import { 7 | CLASS_HIDE, 8 | EVENT_CLICK, 9 | EVENT_FOCUS, 10 | EVENT_HIDE, 11 | EVENT_KEYUP, 12 | EVENT_PICK, 13 | EVENT_SHOW, 14 | LANGUAGES, 15 | NAMESPACE, 16 | VIEWS, 17 | } from './constants'; 18 | import { 19 | getScrollParent, 20 | isNaN, 21 | parseFormat, 22 | selectorOf, 23 | } from './utilities'; 24 | 25 | // Classes 26 | const CLASS_TOP_LEFT = `${NAMESPACE}-top-left`; 27 | const CLASS_TOP_RIGHT = `${NAMESPACE}-top-right`; 28 | const CLASS_BOTTOM_LEFT = `${NAMESPACE}-bottom-left`; 29 | const CLASS_BOTTOM_RIGHT = `${NAMESPACE}-bottom-right`; 30 | const CLASS_PLACEMENTS = [ 31 | CLASS_TOP_LEFT, 32 | CLASS_TOP_RIGHT, 33 | CLASS_BOTTOM_LEFT, 34 | CLASS_BOTTOM_RIGHT, 35 | ].join(' '); 36 | 37 | class Datepicker { 38 | constructor(element, options = {}) { 39 | this.$element = $(element); 40 | this.element = element; 41 | this.options = $.extend( 42 | {}, 43 | DEFAULTS, 44 | LANGUAGES[options.language], 45 | $.isPlainObject(options) && options, 46 | ); 47 | this.$scrollParent = getScrollParent(element, true); 48 | this.built = false; 49 | this.shown = false; 50 | this.isInput = false; 51 | this.inline = false; 52 | this.initialValue = ''; 53 | this.initialDate = null; 54 | this.startDate = null; 55 | this.endDate = null; 56 | this.init(); 57 | } 58 | 59 | init() { 60 | const { $element: $this, options } = this; 61 | let { startDate, endDate, date } = options; 62 | 63 | this.$trigger = $(options.trigger); 64 | this.isInput = $this.is('input') || $this.is('textarea'); 65 | this.inline = options.inline && (options.container || !this.isInput); 66 | this.format = parseFormat(options.format); 67 | 68 | const initialValue = this.getValue(); 69 | 70 | this.initialValue = initialValue; 71 | this.oldValue = initialValue; 72 | date = this.parseDate(date || initialValue); 73 | 74 | if (startDate) { 75 | startDate = this.parseDate(startDate); 76 | 77 | if (date.getTime() < startDate.getTime()) { 78 | date = new Date(startDate); 79 | } 80 | 81 | this.startDate = startDate; 82 | } 83 | 84 | if (endDate) { 85 | endDate = this.parseDate(endDate); 86 | 87 | if (startDate && endDate.getTime() < startDate.getTime()) { 88 | endDate = new Date(startDate); 89 | } 90 | 91 | if (date.getTime() > endDate.getTime()) { 92 | date = new Date(endDate); 93 | } 94 | 95 | this.endDate = endDate; 96 | } 97 | 98 | this.date = date; 99 | this.viewDate = new Date(date); 100 | this.initialDate = new Date(this.date); 101 | this.bind(); 102 | 103 | if (options.autoShow || this.inline) { 104 | this.show(); 105 | } 106 | 107 | if (options.autoPick) { 108 | this.pick(); 109 | } 110 | } 111 | 112 | build() { 113 | if (this.built) { 114 | return; 115 | } 116 | 117 | this.built = true; 118 | 119 | const { $element: $this, options } = this; 120 | const $picker = $(options.template); 121 | 122 | this.$picker = $picker; 123 | this.$week = $picker.find(selectorOf('week')); 124 | 125 | // Years view 126 | this.$yearsPicker = $picker.find(selectorOf('years picker')); 127 | this.$yearsPrev = $picker.find(selectorOf('years prev')); 128 | this.$yearsNext = $picker.find(selectorOf('years next')); 129 | this.$yearsCurrent = $picker.find(selectorOf('years current')); 130 | this.$years = $picker.find(selectorOf('years')); 131 | 132 | // Months view 133 | this.$monthsPicker = $picker.find(selectorOf('months picker')); 134 | this.$yearPrev = $picker.find(selectorOf('year prev')); 135 | this.$yearNext = $picker.find(selectorOf('year next')); 136 | this.$yearCurrent = $picker.find(selectorOf('year current')); 137 | this.$months = $picker.find(selectorOf('months')); 138 | 139 | // Days view 140 | this.$daysPicker = $picker.find(selectorOf('days picker')); 141 | this.$monthPrev = $picker.find(selectorOf('month prev')); 142 | this.$monthNext = $picker.find(selectorOf('month next')); 143 | this.$monthCurrent = $picker.find(selectorOf('month current')); 144 | this.$days = $picker.find(selectorOf('days')); 145 | 146 | if (this.inline) { 147 | $(options.container || $this).append($picker.addClass(`${NAMESPACE}-inline`)); 148 | } else { 149 | $(document.body).append($picker.addClass(`${NAMESPACE}-dropdown`)); 150 | $picker 151 | .addClass(CLASS_HIDE) 152 | .attr('tabindex', '-1') 153 | .attr('aria-hidden', 'true') 154 | .css({ 155 | zIndex: parseInt(options.zIndex, 10), 156 | }); 157 | } 158 | 159 | this.renderWeek(); 160 | } 161 | 162 | unbuild() { 163 | if (!this.built) { 164 | return; 165 | } 166 | 167 | this.built = false; 168 | this.$picker.remove(); 169 | } 170 | 171 | bind() { 172 | const { options, $element: $this } = this; 173 | 174 | if ($.isFunction(options.show)) { 175 | $this.on(EVENT_SHOW, options.show); 176 | } 177 | 178 | if ($.isFunction(options.hide)) { 179 | $this.on(EVENT_HIDE, options.hide); 180 | } 181 | 182 | if ($.isFunction(options.pick)) { 183 | $this.on(EVENT_PICK, options.pick); 184 | } 185 | 186 | if (this.isInput) { 187 | $this.on(EVENT_KEYUP, $.proxy(this.keyup, this)); 188 | } 189 | 190 | if (!this.inline) { 191 | if (options.trigger) { 192 | this.$trigger.on(EVENT_CLICK, $.proxy(this.toggle, this)); 193 | } else if (this.isInput) { 194 | $this.on(EVENT_FOCUS, $.proxy(this.show, this)); 195 | } else { 196 | $this.on(EVENT_CLICK, $.proxy(this.show, this)); 197 | } 198 | } 199 | } 200 | 201 | unbind() { 202 | const { $element: $this, options } = this; 203 | 204 | if ($.isFunction(options.show)) { 205 | $this.off(EVENT_SHOW, options.show); 206 | } 207 | 208 | if ($.isFunction(options.hide)) { 209 | $this.off(EVENT_HIDE, options.hide); 210 | } 211 | 212 | if ($.isFunction(options.pick)) { 213 | $this.off(EVENT_PICK, options.pick); 214 | } 215 | 216 | if (this.isInput) { 217 | $this.off(EVENT_KEYUP, this.keyup); 218 | } 219 | 220 | if (!this.inline) { 221 | if (options.trigger) { 222 | this.$trigger.off(EVENT_CLICK, this.toggle); 223 | } else if (this.isInput) { 224 | $this.off(EVENT_FOCUS, this.show); 225 | } else { 226 | $this.off(EVENT_CLICK, this.show); 227 | } 228 | } 229 | } 230 | 231 | showView(view) { 232 | const { 233 | $yearsPicker, 234 | $monthsPicker, 235 | $daysPicker, 236 | format, 237 | } = this; 238 | 239 | if (format.hasYear || format.hasMonth || format.hasDay) { 240 | switch (Number(view)) { 241 | case VIEWS.YEARS: 242 | $monthsPicker.addClass(CLASS_HIDE); 243 | $daysPicker.addClass(CLASS_HIDE); 244 | 245 | if (format.hasYear) { 246 | this.renderYears(); 247 | $yearsPicker.removeClass(CLASS_HIDE); 248 | this.place(); 249 | } else { 250 | this.showView(VIEWS.DAYS); 251 | } 252 | 253 | break; 254 | 255 | case VIEWS.MONTHS: 256 | $yearsPicker.addClass(CLASS_HIDE); 257 | $daysPicker.addClass(CLASS_HIDE); 258 | 259 | if (format.hasMonth) { 260 | this.renderMonths(); 261 | $monthsPicker.removeClass(CLASS_HIDE); 262 | this.place(); 263 | } else { 264 | this.showView(VIEWS.YEARS); 265 | } 266 | 267 | break; 268 | 269 | // case VIEWS.DAYS: 270 | default: 271 | $yearsPicker.addClass(CLASS_HIDE); 272 | $monthsPicker.addClass(CLASS_HIDE); 273 | 274 | if (format.hasDay) { 275 | this.renderDays(); 276 | $daysPicker.removeClass(CLASS_HIDE); 277 | this.place(); 278 | } else { 279 | this.showView(VIEWS.MONTHS); 280 | } 281 | } 282 | } 283 | } 284 | 285 | hideView() { 286 | if (!this.inline && this.options.autoHide) { 287 | this.hide(); 288 | } 289 | } 290 | 291 | place() { 292 | if (this.inline) { 293 | return; 294 | } 295 | 296 | const { $element: $this, options, $picker } = this; 297 | const containerWidth = $(document).outerWidth(); 298 | const containerHeight = $(document).outerHeight(); 299 | const elementWidth = $this.outerWidth(); 300 | const elementHeight = $this.outerHeight(); 301 | const width = $picker.width(); 302 | const height = $picker.height(); 303 | let { left, top } = $this.offset(); 304 | let offset = parseFloat(options.offset); 305 | let placement = CLASS_TOP_LEFT; 306 | 307 | if (isNaN(offset)) { 308 | offset = 10; 309 | } 310 | 311 | if (top > height && top + elementHeight + height > containerHeight) { 312 | top -= height + offset; 313 | placement = CLASS_BOTTOM_LEFT; 314 | } else { 315 | top += elementHeight + offset; 316 | } 317 | 318 | if (left + width > containerWidth) { 319 | left += elementWidth - width; 320 | placement = placement.replace('left', 'right'); 321 | } 322 | 323 | $picker.removeClass(CLASS_PLACEMENTS).addClass(placement).css({ 324 | top, 325 | left, 326 | }); 327 | } 328 | 329 | // A shortcut for triggering custom events 330 | trigger(type, data) { 331 | const e = $.Event(type, data); 332 | 333 | this.$element.trigger(e); 334 | 335 | return e; 336 | } 337 | 338 | createItem(data) { 339 | const { options } = this; 340 | const { itemTag } = options; 341 | const item = { 342 | text: '', 343 | view: '', 344 | muted: false, 345 | picked: false, 346 | disabled: false, 347 | highlighted: false, 348 | }; 349 | const classes = []; 350 | 351 | $.extend(item, data); 352 | 353 | if (item.muted) { 354 | classes.push(options.mutedClass); 355 | } 356 | 357 | if (item.highlighted) { 358 | classes.push(options.highlightedClass); 359 | } 360 | 361 | if (item.picked) { 362 | classes.push(options.pickedClass); 363 | } 364 | 365 | if (item.disabled) { 366 | classes.push(options.disabledClass); 367 | } 368 | 369 | return (`<${itemTag}${classes.length > 0 ? ` class="${classes.join(' ')}"` : ''}${item.view ? ` data-view="${item.view}"` : '' 370 | }${item.title ? ` title="${item.title}"` : ''}${item.picked ? ' aria-selected="true"' : ''}>${item.text}`); 371 | } 372 | 373 | getValue() { 374 | const $this = this.$element; 375 | 376 | return this.isInput ? $this.val() : $this.text(); 377 | } 378 | 379 | setValue(value = '') { 380 | const $this = this.$element; 381 | 382 | if (this.isInput) { 383 | $this.val(value); 384 | } else if (!this.inline || this.options.container) { 385 | $this.text(value); 386 | } 387 | } 388 | 389 | static setDefaults(options = {}) { 390 | $.extend(DEFAULTS, LANGUAGES[options.language], $.isPlainObject(options) && options); 391 | } 392 | } 393 | 394 | if ($.extend) { 395 | $.extend(Datepicker.prototype, render, handlers, methods); 396 | } 397 | 398 | export default Datepicker; 399 | -------------------------------------------------------------------------------- /src/js/defaults.js: -------------------------------------------------------------------------------- 1 | export default { 2 | // Show the datepicker automatically when initialized 3 | autoShow: false, 4 | 5 | // Hide the datepicker automatically when picked 6 | autoHide: false, 7 | 8 | // Pick the initial date automatically when initialized 9 | autoPick: false, 10 | 11 | // Enable inline mode 12 | inline: false, 13 | 14 | // A element (or selector) for putting the datepicker 15 | container: null, 16 | 17 | // A element (or selector) for triggering the datepicker 18 | trigger: null, 19 | 20 | // The ISO language code (built-in: en-US) 21 | language: '', 22 | 23 | // The date string format 24 | format: 'mm/dd/yyyy', 25 | 26 | // The initial date 27 | date: null, 28 | 29 | // The start view date 30 | startDate: null, 31 | 32 | // The end view date 33 | endDate: null, 34 | 35 | // The start view when initialized 36 | startView: 0, // 0 for days, 1 for months, 2 for years 37 | 38 | // The start day of the week 39 | // 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, 40 | // 4 for Thursday, 5 for Friday, 6 for Saturday 41 | weekStart: 0, 42 | 43 | // Show year before month on the datepicker header 44 | yearFirst: false, 45 | 46 | // A string suffix to the year number. 47 | yearSuffix: '', 48 | 49 | // Days' name of the week. 50 | days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 51 | 52 | // Shorter days' name 53 | daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 54 | 55 | // Shortest days' name 56 | daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], 57 | 58 | // Months' name 59 | months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], 60 | 61 | // Shorter months' name 62 | monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 63 | 64 | // A element tag for each item of years, months and days 65 | itemTag: 'li', 66 | 67 | // A class (CSS) for muted date item 68 | mutedClass: 'muted', 69 | 70 | // A class (CSS) for picked date item 71 | pickedClass: 'picked', 72 | 73 | // A class (CSS) for disabled date item 74 | disabledClass: 'disabled', 75 | 76 | // A class (CSS) for highlight date item 77 | highlightedClass: 'highlighted', 78 | 79 | // The template of the datepicker 80 | template: ( 81 | '
' 82 | + '
' 83 | + '' 88 | + '' 89 | + '
' 90 | + '
' 91 | + '' 96 | + '' 97 | + '
' 98 | + '
' 99 | + '' 104 | + '' 105 | + '' 106 | + '
' 107 | + '
' 108 | ), 109 | 110 | // The offset top or bottom of the datepicker from the element 111 | offset: 10, 112 | 113 | // The `z-index` of the datepicker 114 | zIndex: 1000, 115 | 116 | // Filter each date item (return `false` to disable a date item) 117 | filter: null, 118 | 119 | // Event shortcuts 120 | show: null, 121 | hide: null, 122 | pick: null, 123 | }; 124 | -------------------------------------------------------------------------------- /src/js/handlers.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import { VIEWS } from './constants'; 3 | import { getMinDay } from './utilities'; 4 | 5 | export default { 6 | click(e) { 7 | const $target = $(e.target); 8 | const { 9 | options, 10 | date, 11 | viewDate, 12 | format, 13 | } = this; 14 | 15 | e.stopPropagation(); 16 | e.preventDefault(); 17 | 18 | if ($target.hasClass('disabled')) { 19 | return; 20 | } 21 | 22 | const view = $target.data('view'); 23 | let viewYear = viewDate.getFullYear(); 24 | let viewMonth = viewDate.getMonth(); 25 | let viewDay = viewDate.getDate(); 26 | 27 | switch (view) { 28 | case 'years prev': 29 | case 'years next': { 30 | viewYear = view === 'years prev' ? viewYear - 10 : viewYear + 10; 31 | viewDate.setFullYear(viewYear); 32 | viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay)); 33 | this.renderYears(); 34 | break; 35 | } 36 | 37 | case 'year prev': 38 | case 'year next': 39 | viewYear = view === 'year prev' ? viewYear - 1 : viewYear + 1; 40 | viewDate.setFullYear(viewYear); 41 | viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay)); 42 | this.renderMonths(); 43 | break; 44 | 45 | case 'year current': 46 | if (format.hasYear) { 47 | this.showView(VIEWS.YEARS); 48 | } 49 | 50 | break; 51 | 52 | case 'year picked': 53 | if (format.hasMonth) { 54 | this.showView(VIEWS.MONTHS); 55 | } else { 56 | $target.siblings(`.${options.pickedClass}`) 57 | .removeClass(options.pickedClass) 58 | .attr('data-view', 'year') 59 | .removeAttr('aria-selected'); 60 | this.hideView(); 61 | } 62 | 63 | this.pick('year'); 64 | break; 65 | 66 | case 'year': 67 | viewYear = parseInt($target.text(), 10); 68 | // Set date first to avoid month changing (#195) 69 | date.setDate(getMinDay(viewYear, viewMonth, viewDay)); 70 | date.setFullYear(viewYear); 71 | viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay)); 72 | viewDate.setFullYear(viewYear); 73 | 74 | if (format.hasMonth) { 75 | this.showView(VIEWS.MONTHS); 76 | } else { 77 | $target.addClass(options.pickedClass) 78 | .attr('data-view', 'year picked') 79 | .attr('aria-selected', 'true') 80 | .siblings(`.${options.pickedClass}`) 81 | .removeClass(options.pickedClass) 82 | .attr('data-view', 'year') 83 | .removeAttr('aria-selected'); 84 | this.hideView(); 85 | } 86 | 87 | this.pick('year'); 88 | break; 89 | 90 | case 'month prev': 91 | case 'month next': 92 | viewMonth = view === 'month prev' ? viewMonth - 1 : viewMonth + 1; 93 | 94 | if (viewMonth < 0) { 95 | viewYear -= 1; 96 | viewMonth += 12; 97 | } else if (viewMonth > 11) { 98 | viewYear += 1; 99 | viewMonth -= 12; 100 | } 101 | 102 | viewDate.setFullYear(viewYear); 103 | viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay)); 104 | viewDate.setMonth(viewMonth); 105 | this.renderDays(); 106 | break; 107 | 108 | case 'month current': 109 | if (format.hasMonth) { 110 | this.showView(VIEWS.MONTHS); 111 | } 112 | 113 | break; 114 | 115 | case 'month picked': 116 | if (format.hasDay) { 117 | this.showView(VIEWS.DAYS); 118 | } else { 119 | $target.siblings(`.${options.pickedClass}`) 120 | .removeClass(options.pickedClass) 121 | .attr('data-view', 'month') 122 | .removeAttr('aria-selected'); 123 | this.hideView(); 124 | } 125 | 126 | this.pick('month'); 127 | break; 128 | 129 | case 'month': 130 | viewMonth = $.inArray($target.text(), options.monthsShort); 131 | date.setFullYear(viewYear); 132 | 133 | // Set date before month to avoid month changing (#195) 134 | date.setDate(getMinDay(viewYear, viewMonth, viewDay)); 135 | date.setMonth(viewMonth); 136 | viewDate.setFullYear(viewYear); 137 | viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay)); 138 | viewDate.setMonth(viewMonth); 139 | 140 | if (format.hasDay) { 141 | this.showView(VIEWS.DAYS); 142 | } else { 143 | $target.addClass(options.pickedClass) 144 | .attr('data-view', 'month picked') 145 | .attr('aria-selected', 'true') 146 | .siblings(`.${options.pickedClass}`) 147 | .removeClass(options.pickedClass) 148 | .attr('data-view', 'month') 149 | .removeAttr('aria-selected'); 150 | this.hideView(); 151 | } 152 | 153 | this.pick('month'); 154 | break; 155 | 156 | case 'day prev': 157 | case 'day next': 158 | case 'day': 159 | if (view === 'day prev') { 160 | viewMonth -= 1; 161 | } else if (view === 'day next') { 162 | viewMonth += 1; 163 | } 164 | 165 | viewDay = parseInt($target.text(), 10); 166 | 167 | // Set date to 1 to avoid month changing (#195) 168 | date.setDate(1); 169 | date.setFullYear(viewYear); 170 | date.setMonth(viewMonth); 171 | date.setDate(viewDay); 172 | viewDate.setDate(1); 173 | viewDate.setFullYear(viewYear); 174 | viewDate.setMonth(viewMonth); 175 | viewDate.setDate(viewDay); 176 | this.renderDays(); 177 | 178 | if (view === 'day') { 179 | this.hideView(); 180 | } 181 | 182 | this.pick('day'); 183 | break; 184 | 185 | case 'day picked': 186 | this.hideView(); 187 | this.pick('day'); 188 | break; 189 | 190 | default: 191 | } 192 | }, 193 | 194 | globalClick({ target }) { 195 | const { element, $trigger } = this; 196 | const trigger = $trigger[0]; 197 | let hidden = true; 198 | 199 | while (target !== document) { 200 | if (target === trigger || target === element) { 201 | hidden = false; 202 | break; 203 | } 204 | 205 | target = target.parentNode; 206 | } 207 | 208 | if (hidden) { 209 | this.hide(); 210 | } 211 | }, 212 | 213 | keyup() { 214 | this.update(); 215 | }, 216 | 217 | globalKeyup({ target, key, keyCode }) { 218 | if (this.isInput && target !== this.element && this.shown && (key === 'Tab' || keyCode === 9)) { 219 | this.hide(); 220 | } 221 | }, 222 | 223 | touchstart({ target }) { 224 | // Emulate click in touch devices to support hiding the picker automatically (#197). 225 | if (this.isInput && target !== this.element && !$.contains(this.$picker[0], target)) { 226 | this.hide(); 227 | this.element.blur(); 228 | } 229 | }, 230 | }; 231 | -------------------------------------------------------------------------------- /src/js/index.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import Datepicker from './datepicker'; 3 | import { 4 | NAMESPACE, 5 | LANGUAGES, 6 | } from './constants'; 7 | import { 8 | isString, 9 | isUndefined, 10 | } from './utilities'; 11 | 12 | if ($.fn) { 13 | const AnotherDatepicker = $.fn.datepicker; 14 | 15 | $.fn.datepicker = function jQueryDatepicker(option, ...args) { 16 | let result; 17 | 18 | this.each((i, element) => { 19 | const $element = $(element); 20 | const isDestroy = option === 'destroy'; 21 | let datepicker = $element.data(NAMESPACE); 22 | 23 | if (!datepicker) { 24 | if (isDestroy) { 25 | return; 26 | } 27 | 28 | const options = $.extend({}, $element.data(), $.isPlainObject(option) && option); 29 | 30 | datepicker = new Datepicker(element, options); 31 | $element.data(NAMESPACE, datepicker); 32 | } 33 | 34 | if (isString(option)) { 35 | const fn = datepicker[option]; 36 | 37 | if ($.isFunction(fn)) { 38 | result = fn.apply(datepicker, args); 39 | 40 | if (isDestroy) { 41 | $element.removeData(NAMESPACE); 42 | } 43 | } 44 | } 45 | }); 46 | 47 | return !isUndefined(result) ? result : this; 48 | }; 49 | 50 | $.fn.datepicker.Constructor = Datepicker; 51 | $.fn.datepicker.languages = LANGUAGES; 52 | $.fn.datepicker.setDefaults = Datepicker.setDefaults; 53 | $.fn.datepicker.noConflict = function noConflict() { 54 | $.fn.datepicker = AnotherDatepicker; 55 | return this; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /src/js/methods.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import { 3 | CLASS_HIDE, 4 | EVENT_CLICK, 5 | EVENT_HIDE, 6 | EVENT_KEYUP, 7 | EVENT_PICK, 8 | EVENT_RESIZE, 9 | EVENT_SCROLL, 10 | EVENT_SHOW, 11 | EVENT_TOUCH_START, 12 | IS_TOUCH_DEVICE, 13 | NAMESPACE, 14 | } from './constants'; 15 | import { 16 | addLeadingZero, 17 | isDate, 18 | isNumber, 19 | isString, 20 | isUndefined, 21 | proxy, 22 | } from './utilities'; 23 | 24 | const REGEXP_DIGITS = /\d+/g; 25 | 26 | export default { 27 | // Show the datepicker 28 | show() { 29 | if (!this.built) { 30 | this.build(); 31 | } 32 | 33 | if (this.shown) { 34 | return; 35 | } 36 | 37 | if (this.trigger(EVENT_SHOW).isDefaultPrevented()) { 38 | return; 39 | } 40 | 41 | this.shown = true; 42 | this.$picker.removeClass(CLASS_HIDE).on(EVENT_CLICK, $.proxy(this.click, this)); 43 | this.showView(this.options.startView); 44 | 45 | if (!this.inline) { 46 | this.$picker 47 | .removeAttr('aria-hidden') 48 | .attr('role', 'dialog') 49 | .attr('aria-model', 'true'); 50 | 51 | this.$scrollParent.on(EVENT_SCROLL, $.proxy(this.place, this)); 52 | $(window).on(EVENT_RESIZE, (this.onResize = proxy(this.place, this))); 53 | $(document).on(EVENT_CLICK, (this.onGlobalClick = proxy(this.globalClick, this))); 54 | $(document).on(EVENT_KEYUP, (this.onGlobalKeyup = proxy(this.globalKeyup, this))); 55 | 56 | if (IS_TOUCH_DEVICE) { 57 | $(document).on(EVENT_TOUCH_START, (this.onTouchStart = proxy(this.touchstart, this))); 58 | } 59 | 60 | this.place(); 61 | } 62 | }, 63 | 64 | // Hide the datepicker 65 | hide() { 66 | if (!this.shown) { 67 | return; 68 | } 69 | 70 | if (this.trigger(EVENT_HIDE).isDefaultPrevented()) { 71 | return; 72 | } 73 | 74 | this.shown = false; 75 | this.$picker.addClass(CLASS_HIDE).off(EVENT_CLICK, this.click); 76 | 77 | if (!this.inline) { 78 | this.$picker 79 | .attr('aria-hidden', 'true') 80 | .removeAttr('role') 81 | .removeAttr('aria-model'); 82 | this.$scrollParent.off(EVENT_SCROLL, this.place); 83 | $(window).off(EVENT_RESIZE, this.onResize); 84 | $(document).off(EVENT_CLICK, this.onGlobalClick); 85 | $(document).off(EVENT_KEYUP, this.onGlobalKeyup); 86 | 87 | if (IS_TOUCH_DEVICE) { 88 | $(document).off(EVENT_TOUCH_START, this.onTouchStart); 89 | } 90 | } 91 | }, 92 | 93 | toggle() { 94 | if (this.shown) { 95 | this.hide(); 96 | } else { 97 | this.show(); 98 | } 99 | }, 100 | 101 | // Update the datepicker with the current input value 102 | update() { 103 | const value = this.getValue(); 104 | 105 | if (value === this.oldValue) { 106 | return; 107 | } 108 | 109 | this.setDate(value, true); 110 | this.oldValue = value; 111 | }, 112 | 113 | /** 114 | * Pick the current date to the element 115 | * 116 | * @param {String} _view (private) 117 | */ 118 | pick(_view) { 119 | const $this = this.$element; 120 | let { date } = this; 121 | 122 | if (this.trigger(EVENT_PICK, { 123 | view: _view || '', 124 | date, 125 | }).isDefaultPrevented()) { 126 | return; 127 | } 128 | 129 | date = this.formatDate(this.date); 130 | this.setValue(date); 131 | 132 | if (this.isInput) { 133 | $this.trigger('input'); 134 | $this.trigger('change'); 135 | } 136 | }, 137 | 138 | // Reset the datepicker 139 | reset() { 140 | this.setDate(this.initialDate, true); 141 | this.setValue(this.initialValue); 142 | 143 | if (this.shown) { 144 | this.showView(this.options.startView); 145 | } 146 | }, 147 | 148 | /** 149 | * Get the month name with given argument or the current date 150 | * 151 | * @param {Number} month (optional) 152 | * @param {Boolean} shortForm (optional) 153 | * @return {String} (month name) 154 | */ 155 | getMonthName(month, shortForm) { 156 | const { options } = this; 157 | const { monthsShort } = options; 158 | let { months } = options; 159 | 160 | if ($.isNumeric(month)) { 161 | month = Number(month); 162 | } else if (isUndefined(shortForm)) { 163 | shortForm = month; 164 | } 165 | 166 | if (shortForm === true) { 167 | months = monthsShort; 168 | } 169 | 170 | return months[isNumber(month) ? month : this.date.getMonth()]; 171 | }, 172 | 173 | /** 174 | * Get the day name with given argument or the current date 175 | * 176 | * @param {Number} day (optional) 177 | * @param {Boolean} shortForm (optional) 178 | * @param {Boolean} min (optional) 179 | * @return {String} (day name) 180 | */ 181 | getDayName(day, shortForm, min) { 182 | const { options } = this; 183 | let { days } = options; 184 | 185 | if ($.isNumeric(day)) { 186 | day = Number(day); 187 | } else { 188 | if (isUndefined(min)) { 189 | min = shortForm; 190 | } 191 | 192 | if (isUndefined(shortForm)) { 193 | shortForm = day; 194 | } 195 | } 196 | 197 | if (min) { 198 | days = options.daysMin; 199 | } else if (shortForm) { 200 | days = options.daysShort; 201 | } 202 | 203 | return days[isNumber(day) ? day : this.date.getDay()]; 204 | }, 205 | 206 | /** 207 | * Get the current date 208 | * 209 | * @param {Boolean} formatted (optional) 210 | * @return {Date|String} (date) 211 | */ 212 | getDate(formatted) { 213 | const { date } = this; 214 | 215 | return formatted ? this.formatDate(date) : new Date(date); 216 | }, 217 | 218 | /** 219 | * Set the current date with a new date 220 | * 221 | * @param {Date} date 222 | * @param {Boolean} _updated (private) 223 | */ 224 | setDate(date, _updated) { 225 | const { filter } = this.options; 226 | 227 | if (isDate(date) || isString(date)) { 228 | date = this.parseDate(date); 229 | 230 | if ($.isFunction(filter) && filter.call(this.$element, date, 'day') === false) { 231 | return; 232 | } 233 | 234 | this.date = date; 235 | this.viewDate = new Date(date); 236 | 237 | if (!_updated) { 238 | this.pick(); 239 | } 240 | 241 | if (this.built) { 242 | this.render(); 243 | } 244 | } 245 | }, 246 | 247 | /** 248 | * Set the start view date with a new date 249 | * 250 | * @param {Date|string|null} date 251 | */ 252 | setStartDate(date) { 253 | if (isDate(date) || isString(date)) { 254 | this.startDate = this.parseDate(date); 255 | } else { 256 | this.startDate = null; 257 | } 258 | 259 | if (this.built) { 260 | this.render(); 261 | } 262 | }, 263 | 264 | /** 265 | * Set the end view date with a new date 266 | * 267 | * @param {Date|string|null} date 268 | */ 269 | setEndDate(date) { 270 | if (isDate(date) || isString(date)) { 271 | this.endDate = this.parseDate(date); 272 | } else { 273 | this.endDate = null; 274 | } 275 | 276 | if (this.built) { 277 | this.render(); 278 | } 279 | }, 280 | 281 | /** 282 | * Parse a date string with the set date format 283 | * 284 | * @param {String} date 285 | * @return {Date} (parsed date) 286 | */ 287 | parseDate(date) { 288 | const { format } = this; 289 | let parts = []; 290 | 291 | if (!isDate(date)) { 292 | if (isString(date)) { 293 | parts = date.match(REGEXP_DIGITS) || []; 294 | } 295 | 296 | date = date ? new Date(date) : new Date(); 297 | 298 | if (!isDate(date)) { 299 | date = new Date(); 300 | } 301 | 302 | if (parts.length === format.parts.length) { 303 | // Set year and month first 304 | $.each(parts, (i, part) => { 305 | const value = parseInt(part, 10); 306 | 307 | switch (format.parts[i]) { 308 | case 'yy': 309 | date.setFullYear(2000 + value); 310 | break; 311 | 312 | case 'yyyy': 313 | // Converts 2-digit year to 2000+ 314 | date.setFullYear(part.length === 2 ? 2000 + value : value); 315 | break; 316 | 317 | case 'mm': 318 | case 'm': 319 | date.setMonth(value - 1); 320 | break; 321 | 322 | default: 323 | } 324 | }); 325 | 326 | // Set day in the last to avoid converting `31/10/2019` to `01/10/2019` 327 | $.each(parts, (i, part) => { 328 | const value = parseInt(part, 10); 329 | 330 | switch (format.parts[i]) { 331 | case 'dd': 332 | case 'd': 333 | date.setDate(value); 334 | break; 335 | 336 | default: 337 | } 338 | }); 339 | } 340 | } 341 | 342 | // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192) 343 | return new Date(date.getFullYear(), date.getMonth(), date.getDate()); 344 | }, 345 | 346 | /** 347 | * Format a date object to a string with the set date format 348 | * 349 | * @param {Date} date 350 | * @return {String} (formatted date) 351 | */ 352 | formatDate(date) { 353 | const { format } = this; 354 | let formatted = ''; 355 | 356 | if (isDate(date)) { 357 | const year = date.getFullYear(); 358 | const month = date.getMonth(); 359 | const day = date.getDate(); 360 | const values = { 361 | d: day, 362 | dd: addLeadingZero(day, 2), 363 | m: month + 1, 364 | mm: addLeadingZero(month + 1, 2), 365 | yy: String(year).substring(2), 366 | yyyy: addLeadingZero(year, 4), 367 | }; 368 | 369 | formatted = format.source; 370 | $.each(format.parts, (i, part) => { 371 | formatted = formatted.replace(part, values[part]); 372 | }); 373 | } 374 | 375 | return formatted; 376 | }, 377 | 378 | // Destroy the datepicker and remove the instance from the target element 379 | destroy() { 380 | this.unbind(); 381 | this.unbuild(); 382 | this.$element.removeData(NAMESPACE); 383 | }, 384 | }; 385 | -------------------------------------------------------------------------------- /src/js/render.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import { getDaysInMonth } from './utilities'; 3 | 4 | export default { 5 | render() { 6 | this.renderYears(); 7 | this.renderMonths(); 8 | this.renderDays(); 9 | }, 10 | 11 | renderWeek() { 12 | const items = []; 13 | let { weekStart, days, daysMin } = this.options; 14 | 15 | weekStart = parseInt(weekStart, 10) % 7; 16 | days = days.slice(weekStart).concat(days.slice(0, weekStart)); 17 | daysMin = daysMin.slice(weekStart).concat(daysMin.slice(0, weekStart)); 18 | $.each(daysMin, (i, day) => { 19 | items.push(this.createItem({ 20 | text: day, 21 | title: days[i], 22 | })); 23 | }); 24 | 25 | this.$week.html(items.join('')); 26 | }, 27 | 28 | renderYears() { 29 | const { 30 | options, 31 | startDate, 32 | endDate, 33 | } = this; 34 | const { disabledClass, filter, yearSuffix } = options; 35 | const viewYear = this.viewDate.getFullYear(); 36 | const now = new Date(); 37 | const thisYear = now.getFullYear(); 38 | const year = this.date.getFullYear(); 39 | const start = -5; 40 | const end = 6; 41 | const items = []; 42 | let prevDisabled = false; 43 | let nextDisabled = false; 44 | let i; 45 | 46 | for (i = start; i <= end; i += 1) { 47 | const date = new Date(viewYear + i, 1, 1); 48 | let disabled = false; 49 | 50 | if (startDate) { 51 | disabled = date.getFullYear() < startDate.getFullYear(); 52 | 53 | if (i === start) { 54 | prevDisabled = disabled; 55 | } 56 | } 57 | 58 | if (!disabled && endDate) { 59 | disabled = date.getFullYear() > endDate.getFullYear(); 60 | 61 | if (i === end) { 62 | nextDisabled = disabled; 63 | } 64 | } 65 | 66 | if (!disabled && filter) { 67 | disabled = filter.call(this.$element, date, 'year') === false; 68 | } 69 | 70 | const picked = (viewYear + i) === year; 71 | const view = picked ? 'year picked' : 'year'; 72 | 73 | items.push(this.createItem({ 74 | picked, 75 | disabled, 76 | text: viewYear + i, 77 | view: disabled ? 'year disabled' : view, 78 | highlighted: date.getFullYear() === thisYear, 79 | })); 80 | } 81 | 82 | this.$yearsPrev.toggleClass(disabledClass, prevDisabled); 83 | this.$yearsNext.toggleClass(disabledClass, nextDisabled); 84 | this.$yearsCurrent 85 | .toggleClass(disabledClass, true) 86 | .html(`${(viewYear + start) + yearSuffix} - ${viewYear + end}${yearSuffix}`); 87 | this.$years.html(items.join('')); 88 | }, 89 | 90 | renderMonths() { 91 | const { 92 | options, 93 | startDate, 94 | endDate, 95 | viewDate, 96 | } = this; 97 | const disabledClass = options.disabledClass || ''; 98 | const months = options.monthsShort; 99 | const filter = $.isFunction(options.filter) && options.filter; 100 | const viewYear = viewDate.getFullYear(); 101 | const now = new Date(); 102 | const thisYear = now.getFullYear(); 103 | const thisMonth = now.getMonth(); 104 | const year = this.date.getFullYear(); 105 | const month = this.date.getMonth(); 106 | const items = []; 107 | let prevDisabled = false; 108 | let nextDisabled = false; 109 | let i; 110 | 111 | for (i = 0; i <= 11; i += 1) { 112 | const date = new Date(viewYear, i, 1); 113 | let disabled = false; 114 | 115 | if (startDate) { 116 | prevDisabled = date.getFullYear() === startDate.getFullYear(); 117 | disabled = prevDisabled && date.getMonth() < startDate.getMonth(); 118 | } 119 | 120 | if (!disabled && endDate) { 121 | nextDisabled = date.getFullYear() === endDate.getFullYear(); 122 | disabled = nextDisabled && date.getMonth() > endDate.getMonth(); 123 | } 124 | 125 | if (!disabled && filter) { 126 | disabled = filter.call(this.$element, date, 'month') === false; 127 | } 128 | 129 | const picked = viewYear === year && i === month; 130 | const view = picked ? 'month picked' : 'month'; 131 | 132 | items.push(this.createItem({ 133 | disabled, 134 | picked, 135 | highlighted: viewYear === thisYear && date.getMonth() === thisMonth, 136 | index: i, 137 | text: months[i], 138 | view: disabled ? 'month disabled' : view, 139 | })); 140 | } 141 | 142 | this.$yearPrev.toggleClass(disabledClass, prevDisabled); 143 | this.$yearNext.toggleClass(disabledClass, nextDisabled); 144 | this.$yearCurrent 145 | .toggleClass(disabledClass, prevDisabled && nextDisabled) 146 | .html(viewYear + options.yearSuffix || ''); 147 | this.$months.html(items.join('')); 148 | }, 149 | 150 | renderDays() { 151 | const { 152 | $element, 153 | options, 154 | startDate, 155 | endDate, 156 | viewDate, 157 | date: currentDate, 158 | } = this; 159 | const { 160 | disabledClass, 161 | filter, 162 | months, 163 | weekStart, 164 | yearSuffix, 165 | } = options; 166 | const viewYear = viewDate.getFullYear(); 167 | const viewMonth = viewDate.getMonth(); 168 | const now = new Date(); 169 | const thisYear = now.getFullYear(); 170 | const thisMonth = now.getMonth(); 171 | const thisDay = now.getDate(); 172 | const year = currentDate.getFullYear(); 173 | const month = currentDate.getMonth(); 174 | const day = currentDate.getDate(); 175 | let length; 176 | let i; 177 | let n; 178 | 179 | // Days of prev month 180 | // ----------------------------------------------------------------------- 181 | 182 | const prevItems = []; 183 | let prevViewYear = viewYear; 184 | let prevViewMonth = viewMonth; 185 | let prevDisabled = false; 186 | 187 | if (viewMonth === 0) { 188 | prevViewYear -= 1; 189 | prevViewMonth = 11; 190 | } else { 191 | prevViewMonth -= 1; 192 | } 193 | 194 | // The length of the days of prev month 195 | length = getDaysInMonth(prevViewYear, prevViewMonth); 196 | 197 | // The first day of current month 198 | const firstDay = new Date(viewYear, viewMonth, 1); 199 | 200 | // The visible length of the days of prev month 201 | // [0,1,2,3,4,5,6] - [0,1,2,3,4,5,6] => [-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6] 202 | n = firstDay.getDay() - (parseInt(weekStart, 10) % 7); 203 | 204 | // [-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6] => [1,2,3,4,5,6,7] 205 | if (n <= 0) { 206 | n += 7; 207 | } 208 | 209 | if (startDate) { 210 | prevDisabled = firstDay.getTime() <= startDate.getTime(); 211 | } 212 | 213 | for (i = length - (n - 1); i <= length; i += 1) { 214 | const prevViewDate = new Date(prevViewYear, prevViewMonth, i); 215 | let disabled = false; 216 | 217 | if (startDate) { 218 | disabled = prevViewDate.getTime() < startDate.getTime(); 219 | } 220 | 221 | if (!disabled && filter) { 222 | disabled = filter.call($element, prevViewDate, 'day') === false; 223 | } 224 | 225 | prevItems.push(this.createItem({ 226 | disabled, 227 | highlighted: ( 228 | prevViewYear === thisYear 229 | && prevViewMonth === thisMonth 230 | && prevViewDate.getDate() === thisDay 231 | ), 232 | muted: true, 233 | picked: prevViewYear === year && prevViewMonth === month && i === day, 234 | text: i, 235 | view: 'day prev', 236 | })); 237 | } 238 | 239 | // Days of next month 240 | // ----------------------------------------------------------------------- 241 | 242 | const nextItems = []; 243 | let nextViewYear = viewYear; 244 | let nextViewMonth = viewMonth; 245 | let nextDisabled = false; 246 | 247 | if (viewMonth === 11) { 248 | nextViewYear += 1; 249 | nextViewMonth = 0; 250 | } else { 251 | nextViewMonth += 1; 252 | } 253 | 254 | // The length of the days of current month 255 | length = getDaysInMonth(viewYear, viewMonth); 256 | 257 | // The visible length of next month (42 means 6 rows and 7 columns) 258 | n = 42 - (prevItems.length + length); 259 | 260 | // The last day of current month 261 | const lastDate = new Date(viewYear, viewMonth, length); 262 | 263 | if (endDate) { 264 | nextDisabled = lastDate.getTime() >= endDate.getTime(); 265 | } 266 | 267 | for (i = 1; i <= n; i += 1) { 268 | const date = new Date(nextViewYear, nextViewMonth, i); 269 | const picked = nextViewYear === year && nextViewMonth === month && i === day; 270 | let disabled = false; 271 | 272 | if (endDate) { 273 | disabled = date.getTime() > endDate.getTime(); 274 | } 275 | 276 | if (!disabled && filter) { 277 | disabled = filter.call($element, date, 'day') === false; 278 | } 279 | 280 | nextItems.push(this.createItem({ 281 | disabled, 282 | picked, 283 | highlighted: ( 284 | nextViewYear === thisYear 285 | && nextViewMonth === thisMonth 286 | && date.getDate() === thisDay 287 | ), 288 | muted: true, 289 | text: i, 290 | view: 'day next', 291 | })); 292 | } 293 | 294 | // Days of current month 295 | // ----------------------------------------------------------------------- 296 | 297 | const items = []; 298 | 299 | for (i = 1; i <= length; i += 1) { 300 | const date = new Date(viewYear, viewMonth, i); 301 | let disabled = false; 302 | 303 | if (startDate) { 304 | disabled = date.getTime() < startDate.getTime(); 305 | } 306 | 307 | if (!disabled && endDate) { 308 | disabled = date.getTime() > endDate.getTime(); 309 | } 310 | 311 | if (!disabled && filter) { 312 | disabled = filter.call($element, date, 'day') === false; 313 | } 314 | 315 | const picked = viewYear === year && viewMonth === month && i === day; 316 | const view = picked ? 'day picked' : 'day'; 317 | 318 | items.push(this.createItem({ 319 | disabled, 320 | picked, 321 | highlighted: ( 322 | viewYear === thisYear 323 | && viewMonth === thisMonth 324 | && date.getDate() === thisDay 325 | ), 326 | text: i, 327 | view: disabled ? 'day disabled' : view, 328 | })); 329 | } 330 | 331 | // Render days picker 332 | // ----------------------------------------------------------------------- 333 | 334 | this.$monthPrev.toggleClass(disabledClass, prevDisabled); 335 | this.$monthNext.toggleClass(disabledClass, nextDisabled); 336 | this.$monthCurrent 337 | .toggleClass(disabledClass, prevDisabled && nextDisabled) 338 | .html(options.yearFirst 339 | ? `${viewYear + yearSuffix} ${months[viewMonth]}` 340 | : `${months[viewMonth]} ${viewYear}${yearSuffix}`); 341 | this.$days.html(prevItems.join('') + items.join('') + nextItems.join('')); 342 | }, 343 | }; 344 | -------------------------------------------------------------------------------- /src/js/utilities.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import { WINDOW } from './constants'; 3 | 4 | const { toString } = Object.prototype; 5 | 6 | export function typeOf(obj) { 7 | return toString.call(obj).slice(8, -1).toLowerCase(); 8 | } 9 | 10 | export function isString(value) { 11 | return typeof value === 'string'; 12 | } 13 | 14 | export const isNaN = Number.isNaN || WINDOW.isNaN; 15 | 16 | export function isNumber(value) { 17 | return typeof value === 'number' && !isNaN(value); 18 | } 19 | 20 | export function isUndefined(value) { 21 | return typeof value === 'undefined'; 22 | } 23 | 24 | export function isDate(value) { 25 | return typeOf(value) === 'date' && !isNaN(value.getTime()); 26 | } 27 | 28 | export function proxy(fn, context, ...args) { 29 | return (...args2) => fn.apply(context, args.concat(args2)); 30 | } 31 | 32 | export function selectorOf(view) { 33 | return `[data-view="${view}"]`; 34 | } 35 | 36 | export function isLeapYear(year) { 37 | return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; 38 | } 39 | 40 | export function getDaysInMonth(year, month) { 41 | return [31, (isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; 42 | } 43 | 44 | export function getMinDay(year, month, day) { 45 | return Math.min(day, getDaysInMonth(year, month)); 46 | } 47 | 48 | const formatParts = /(y|m|d)+/g; 49 | 50 | export function parseFormat(format) { 51 | const source = String(format).toLowerCase(); 52 | const parts = source.match(formatParts); 53 | 54 | if (!parts || parts.length === 0) { 55 | throw new Error('Invalid date format.'); 56 | } 57 | 58 | format = { 59 | source, 60 | parts, 61 | }; 62 | 63 | $.each(parts, (i, part) => { 64 | switch (part) { 65 | case 'dd': 66 | case 'd': 67 | format.hasDay = true; 68 | break; 69 | 70 | case 'mm': 71 | case 'm': 72 | format.hasMonth = true; 73 | break; 74 | 75 | case 'yyyy': 76 | case 'yy': 77 | format.hasYear = true; 78 | break; 79 | 80 | default: 81 | } 82 | }); 83 | 84 | return format; 85 | } 86 | 87 | export function getScrollParent(element, includeHidden = false) { 88 | const $element = $(element); 89 | const position = $element.css('position'); 90 | const excludeStaticParent = position === 'absolute'; 91 | const overflowRegex = includeHidden ? /auto|scroll|hidden/ : /auto|scroll/; 92 | const scrollParent = $element.parents() 93 | .filter((index, parent) => { 94 | const $parent = $(parent); 95 | 96 | if (excludeStaticParent && $parent.css('position') === 'static') { 97 | return false; 98 | } 99 | 100 | return overflowRegex.test( 101 | $parent.css('overflow') + $parent.css('overflow-y') + $parent.css('overflow-x'), 102 | ); 103 | }) 104 | .eq(0); 105 | 106 | return position === 'fixed' || !scrollParent.length 107 | ? $(element.ownerDocument || document) 108 | : scrollParent; 109 | } 110 | 111 | /** 112 | * Add leading zeroes to the given value 113 | * @param {number} value - The value to add. 114 | * @param {number} [length=1] - The expected value length. 115 | * @returns {string} Returns converted value. 116 | */ 117 | export function addLeadingZero(value, length = 1) { 118 | const str = String(Math.abs(value)); 119 | let i = str.length; 120 | let result = ''; 121 | 122 | if (value < 0) { 123 | result += '-'; 124 | } 125 | 126 | while (i < length) { 127 | i += 1; 128 | result += '0'; 129 | } 130 | 131 | return result + str; 132 | } 133 | -------------------------------------------------------------------------------- /test/css/main.css: -------------------------------------------------------------------------------- 1 | .container { 2 | max-width: 640px; 3 | margin: 20px auto; 4 | } 5 | -------------------------------------------------------------------------------- /test/events/hide.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var $input = window.createInput(); 3 | 4 | $input.on('hide.datepicker', function (e) { 5 | QUnit.test('events.hide', function (assert) { 6 | assert.equal(e.type, 'hide'); 7 | assert.equal(e.namespace, 'datepicker'); 8 | }); 9 | }).datepicker({ 10 | hide: function (e) { 11 | QUnit.test('options.hide', function (assert) { 12 | assert.equal(e.type, 'hide'); 13 | assert.equal(e.namespace, 'datepicker'); 14 | }); 15 | } 16 | }).datepicker('show').datepicker('hide'); 17 | }); 18 | -------------------------------------------------------------------------------- /test/events/pick.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var $input = window.createInput(); 3 | var initialDate = new Date(2014, 1, 14); 4 | 5 | $input.on('pick.datepicker', function (e) { 6 | QUnit.test('events.pick', function (assert) { 7 | assert.equal(e.type, 'pick'); 8 | assert.equal(e.namespace, 'datepicker'); 9 | assert.equal(e.date.getTime(), initialDate.getTime()); 10 | assert.equal(e.view, ''); 11 | }); 12 | }).datepicker({ 13 | date: initialDate, 14 | 15 | pick: function (e) { 16 | QUnit.test('options.pick', function (assert) { 17 | assert.equal(e.type, 'pick'); 18 | assert.equal(e.namespace, 'datepicker'); 19 | assert.equal(e.date.getTime(), initialDate.getTime()); 20 | assert.equal(e.view, ''); 21 | }); 22 | } 23 | }).datepicker('pick'); 24 | }); 25 | -------------------------------------------------------------------------------- /test/events/show.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var $input = window.createInput(); 3 | 4 | $input.on('show.datepicker', function (e) { 5 | QUnit.test('events.show', function (assert) { 6 | assert.equal(e.type, 'show'); 7 | assert.equal(e.namespace, 'datepicker'); 8 | }); 9 | }).datepicker({ 10 | show: function (e) { 11 | QUnit.test('options.show', function (assert) { 12 | assert.equal(e.type, 'show'); 13 | assert.equal(e.namespace, 'datepicker'); 14 | }); 15 | } 16 | }).datepicker('show').datepicker('hide'); 17 | }); 18 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Datepicker 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /test/js/main.js: -------------------------------------------------------------------------------- 1 | window.createContainer = function () { 2 | var $container = $('
'); 3 | 4 | $container.appendTo(document.body); 5 | 6 | return $container; 7 | }; 8 | 9 | window.createInput = function (attrs) { 10 | var $input = $(''); 11 | 12 | if (typeof attrs === 'object') { 13 | $input.attr(attrs); 14 | } 15 | 16 | window.createContainer().append($input); 17 | 18 | return $input; 19 | }; 20 | -------------------------------------------------------------------------------- /test/methods/destroy.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.destroy', function (assert) { 2 | var $input = window.createInput(); 3 | 4 | $input.datepicker(); 5 | assert.ok(typeof $input.data('datepicker') === 'object'); 6 | $input.datepicker('destroy'); 7 | assert.ok(typeof $input.data('datepicker') === 'undefined'); 8 | }); 9 | -------------------------------------------------------------------------------- /test/methods/formatDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.formatDate', function (assert) { 2 | var $input = window.createInput(); 3 | 4 | assert.equal($input.datepicker('formatDate', new Date(2014, 1, 14)), '02/14/2014'); 5 | }); 6 | -------------------------------------------------------------------------------- /test/methods/getDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.getDate', function (assert) { 2 | var $input = window.createInput(); 3 | var initialDate = new Date(2014, 1, 14); 4 | var initialDateString = '02/14/2014'; 5 | 6 | $input.datepicker({ 7 | date: initialDate 8 | }); 9 | 10 | assert.equal($input.datepicker('getDate').getTime(), initialDate.getTime()); 11 | assert.equal($input.datepicker('getDate', true), initialDateString); 12 | }); 13 | -------------------------------------------------------------------------------- /test/methods/getDayName.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.getDayName', function (assert) { 2 | var $input = window.createInput(); 3 | var options = $input.datepicker().data('datepicker').options; 4 | var day = $input.datepicker('getDate').getDay(); 5 | 6 | assert.equal($input.datepicker('getDayName'), options.days[day]); 7 | assert.equal($input.datepicker('getDayName', true), options.daysShort[day]); 8 | assert.equal($input.datepicker('getDayName', true, true), options.daysMin[day]); 9 | assert.equal($input.datepicker('getDayName', false, true), options.daysMin[day]); 10 | assert.equal($input.datepicker('getDayName', 0), options.days[0]); 11 | assert.equal($input.datepicker('getDayName', 0, true), options.daysShort[0]); 12 | assert.equal($input.datepicker('getDayName', 0, true, true), options.daysMin[0]); 13 | assert.equal($input.datepicker('getDayName', 0, false, true), options.daysMin[0]); 14 | }); 15 | -------------------------------------------------------------------------------- /test/methods/getMonthName.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.getMonthName', function (assert) { 2 | var $input = window.createInput(); 3 | var options = $input.datepicker().data('datepicker').options; 4 | var month = $input.datepicker('getDate').getMonth(); 5 | 6 | assert.equal($input.datepicker('getMonthName'), options.months[month]); 7 | assert.equal($input.datepicker('getMonthName', true), options.monthsShort[month]); 8 | assert.equal($input.datepicker('getMonthName', 0), options.months[0]); 9 | assert.equal($input.datepicker('getMonthName', 0, true), options.monthsShort[0]); 10 | }); 11 | -------------------------------------------------------------------------------- /test/methods/hide.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.hide', function (assert) { 2 | var $input = window.createInput(); 3 | var datepicker = $input.datepicker().data('datepicker'); 4 | 5 | $input.datepicker('show'); 6 | assert.ok(datepicker.shown); 7 | $input.datepicker('hide'); 8 | assert.ok(!datepicker.shown); 9 | assert.ok(datepicker.$picker.is(':hidden')); 10 | }); 11 | -------------------------------------------------------------------------------- /test/methods/parseDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.parseDate', function (assert) { 2 | var $input = window.createInput(); 3 | var date = $input.datepicker('parseDate', '02/14/2014'); 4 | 5 | assert.equal(date.getFullYear(), 2014); 6 | assert.equal(date.getMonth(), 1); 7 | assert.equal(date.getDate(), 14); 8 | }); 9 | -------------------------------------------------------------------------------- /test/methods/pick.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.pick', function (assert) { 2 | var $input = window.createInput(); 3 | 4 | assert.equal($input.val(), ''); 5 | $input.datepicker('pick'); 6 | assert.equal($input.val(), $input.datepicker('getDate', true)); 7 | }); 8 | -------------------------------------------------------------------------------- /test/methods/reset.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.reset', function (assert) { 2 | var initialValue = '02/14/2014'; 3 | var $input = window.createInput({ 4 | value: initialValue 5 | }); 6 | 7 | $input.datepicker('show'); 8 | $input.datepicker('setDate', '02/28/2014'); 9 | $input.datepicker('reset'); 10 | assert.equal($input.datepicker('getDate', true), initialValue); 11 | $input.datepicker('hide'); 12 | }); 13 | -------------------------------------------------------------------------------- /test/methods/setDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.setDate', function (assert) { 2 | var $input = window.createInput(); 3 | var initialDate = new Date(2014, 1, 14); 4 | var initialDate2 = '02/28/2015'; 5 | 6 | $input.datepicker('setDate', initialDate); 7 | assert.equal($input.datepicker('getDate').getTime(), initialDate.getTime()); 8 | 9 | $input.datepicker('setDate', initialDate2); 10 | assert.equal($input.datepicker('getDate', true), initialDate2); 11 | }); 12 | -------------------------------------------------------------------------------- /test/methods/setEndDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.setEndDate', function (assert) { 2 | var $input = window.createInput(); 3 | var initialDate = new Date(2014, 1, 14); 4 | 5 | $input.datepicker('setEndDate', initialDate); 6 | assert.equal($input.data('datepicker').endDate.getTime(), initialDate.getTime()); 7 | }); 8 | -------------------------------------------------------------------------------- /test/methods/setStartDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.setStartDate', function (assert) { 2 | var $input = window.createInput(); 3 | var initialDate = new Date(2014, 1, 14); 4 | 5 | $input.datepicker('setStartDate', initialDate); 6 | assert.equal($input.data('datepicker').startDate.getTime(), initialDate.getTime()); 7 | }); 8 | -------------------------------------------------------------------------------- /test/methods/show.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.show', function (assert) { 2 | var $input = window.createInput(); 3 | var datepicker = $input.datepicker().data('datepicker'); 4 | 5 | assert.ok(!datepicker.shown); 6 | $input.datepicker('show'); 7 | assert.ok(datepicker.shown); 8 | assert.ok(datepicker.$picker.is(':visible')); 9 | $input.datepicker('hide'); 10 | }); 11 | -------------------------------------------------------------------------------- /test/methods/update.js: -------------------------------------------------------------------------------- 1 | QUnit.test('method.update', function (assert) { 2 | var $input = window.createInput(); 3 | var datepicker = $input.datepicker().data('datepicker'); 4 | var val = '02/14/2014'; 5 | 6 | $input.val(val); 7 | $input.datepicker('update'); 8 | assert.equal($input.datepicker('getDate', true), val); 9 | }); 10 | -------------------------------------------------------------------------------- /test/options/autoHide.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.autoHide', function (assert) { 2 | var $input = window.createInput(); 3 | var datepicker = $input.datepicker({ 4 | autoHide: true 5 | }).data('datepicker'); 6 | 7 | $input.datepicker('show'); 8 | datepicker.$days.children().eq(20).click(); 9 | assert.ok(datepicker.$picker.is(':hidden')); 10 | }); 11 | -------------------------------------------------------------------------------- /test/options/autoPick.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.autoPick', function (assert) { 2 | var $input = window.createInput(); 3 | 4 | $input.datepicker({ 5 | autoPick: true 6 | }); 7 | 8 | assert.equal($input.val(), $input.datepicker('getDate', true)); 9 | }); 10 | -------------------------------------------------------------------------------- /test/options/autoShow.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.autoShow', function (assert) { 2 | var $input = window.createInput(); 3 | var datepicker = $input.datepicker({ 4 | autoShow: true 5 | }).data('datepicker'); 6 | 7 | assert.ok(datepicker.$picker.is(':visible')); 8 | $input.datepicker('hide'); 9 | }); 10 | -------------------------------------------------------------------------------- /test/options/date.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.date: Date', function (assert) { 2 | var $input = window.createInput(); 3 | var initialDate = new Date(2014, 1, 14); 4 | 5 | $input.datepicker({ 6 | date: initialDate 7 | }); 8 | 9 | assert.equal($input.datepicker('getDate').getTime(), initialDate.getTime()); 10 | }); 11 | 12 | QUnit.test('options.date: String', function (assert) { 13 | var $input = window.createInput(); 14 | var initialDate = '02/14/2014'; 15 | 16 | $input.datepicker({ 17 | date: initialDate 18 | }); 19 | 20 | assert.equal($input.datepicker('getDate', true), initialDate); 21 | }); 22 | -------------------------------------------------------------------------------- /test/options/endDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.endDate', function (assert) { 2 | var $input = window.createInput(); 3 | var endDate = new Date(2014, 1, 14); 4 | 5 | $input.datepicker({ 6 | endDate: endDate 7 | }); 8 | 9 | assert.ok($input.datepicker('getDate').getTime() <= endDate.getTime()); 10 | }); 11 | -------------------------------------------------------------------------------- /test/options/filter.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.filter', function (assert) { 2 | var $input = window.createInput(); 3 | var datepicker = $input.datepicker({ 4 | filter: function (date) { 5 | 6 | // Disable all Sundays 7 | if (date.getDay() === 0) { 8 | return false; 9 | } 10 | } 11 | }).data('datepicker'); 12 | 13 | $input.datepicker('show'); 14 | 15 | datepicker.$days.children().each(function (i) { 16 | if (i % 7 === 0) { 17 | assert.ok($(this).hasClass(datepicker.options.disabledClass)); 18 | } 19 | }); 20 | 21 | $input.datepicker('hide'); 22 | }); 23 | -------------------------------------------------------------------------------- /test/options/format.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.format', function (assert) { 2 | var $input = window.createInput(); 3 | var formatted = '2015/11/11'; 4 | 5 | $input.datepicker({ 6 | date: formatted, 7 | format: 'yyyy/mm/dd' 8 | }); 9 | 10 | assert.equal($input.datepicker('getDate', true), formatted); 11 | }); 12 | -------------------------------------------------------------------------------- /test/options/inline.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.inline: input', function (assert) { 2 | var $input = window.createInput(); 3 | var $container = window.createContainer(); 4 | 5 | $input.datepicker({ 6 | inline: true, 7 | container: $container 8 | }); 9 | assert.ok(!$container.is(':empty')); 10 | }); 11 | 12 | QUnit.test('options.inline: not input', function (assert) { 13 | var $container = window.createContainer(); 14 | 15 | assert.ok($container.is(':empty')); 16 | $container.datepicker({ 17 | inline: true 18 | }); 19 | assert.ok(!$container.is(':empty')); 20 | }); 21 | -------------------------------------------------------------------------------- /test/options/startDate.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.startDate', function (assert) { 2 | var $input = window.createInput(); 3 | var startDate = new Date(2014, 1, 14); 4 | 5 | $input.datepicker({ 6 | startDate: startDate 7 | }); 8 | 9 | assert.ok($input.datepicker('getDate').getTime() >= startDate.getTime()); 10 | }); 11 | -------------------------------------------------------------------------------- /test/options/startView.js: -------------------------------------------------------------------------------- 1 | QUnit.test('options.startView: 0', function (assert) { 2 | var $input = window.createInput(); 3 | 4 | $input.datepicker({ 5 | startView: 0 6 | }).datepicker('show'); 7 | 8 | assert.ok($input.data('datepicker').$daysPicker.is(':visible')); 9 | $input.datepicker('hide'); 10 | }); 11 | 12 | QUnit.test('options.startView: 1', function (assert) { 13 | var $input = window.createInput(); 14 | 15 | $input.datepicker({ 16 | startView: 1 17 | }).datepicker('show'); 18 | 19 | assert.ok($input.data('datepicker').$monthsPicker.is(':visible')); 20 | $input.datepicker('hide'); 21 | }); 22 | 23 | QUnit.test('options.startView: 2', function (assert) { 24 | var $input = window.createInput(); 25 | 26 | $input.datepicker({ 27 | startView: 2 28 | }).datepicker('show'); 29 | 30 | assert.ok($input.data('datepicker').$yearsPicker.is(':visible')); 31 | $input.datepicker('hide'); 32 | }); 33 | --------------------------------------------------------------------------------