{"id":13660028,"url":"https://github.com/vitalets/bootstrap-datepicker","last_synced_at":"2025-10-22T21:04:40.259Z","repository":{"id":4321581,"uuid":"5455956","full_name":"vitalets/bootstrap-datepicker","owner":"vitalets","description":"Bootstrap datepicker originally by Stefan Petre, improved by @eternicode","archived":false,"fork":true,"pushed_at":"2018-08-02T06:04:56.000Z","size":764,"stargazers_count":174,"open_issues_count":6,"forks_count":61,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-04-13T21:46:53.643Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://vitalets.github.com/bootstrap-datepicker/","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"uxsolutions/bootstrap-datepicker","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitalets.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-17T18:33:21.000Z","updated_at":"2024-03-26T10:18:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vitalets/bootstrap-datepicker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitalets%2Fbootstrap-datepicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitalets%2Fbootstrap-datepicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitalets%2Fbootstrap-datepicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitalets%2Fbootstrap-datepicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitalets","download_url":"https://codeload.github.com/vitalets/bootstrap-datepicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223917174,"owners_count":17224894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:01:15.165Z","updated_at":"2025-10-22T21:04:39.923Z","avatar_url":"https://github.com/vitalets.png","language":"JavaScript","readme":"## This fork was created for *inline* version of datepicker and currently merged into upstream https://github.com/eternicode/bootstrap-datepicker.\nPlease use original repo for pull requests, thanks!\n\n# Home\n\nThis is a fork of Stefan Petre's [original code](http://www.eyecon.ro/bootstrap-datepicker/);\nthanks go to him for getting this thing started!\n\nPlease note that this fork is not used on Stefan's page at this time, nor is it maintained or\ncontributed to by him (yet?)\n\n# Example\n\nAttached to a field with the format specified via options:\n\n```html\n\u003cinput type=\"text\" value=\"02-16-2012\" id=\"datepicker\"\u003e\n```\n```javascript\n$('#datepicker').datepicker({\n    format: 'mm-dd-yyyy'\n});\n```\n\nAttached to a field with the format specified via data tag:\n\n```html\n\u003cinput type=\"text\" value=\"02/16/12\" data-date-format=\"mm/dd/yy\" id=\"datepicker\" \u003e\n```\n```javascript\n$('#datepicker').datepicker();\n```\n\nAs component:\n\n```html\n\u003cdiv class=\"input-append date\" id=\"datepicker\" data-date=\"12-02-2012\" data-date-format=\"dd-mm-yyyy\"\u003e\n    \u003cinput size=\"16\" type=\"text\" value=\"12-02-2012\" readonly\u003e\n    \u003cspan class=\"add-on\"\u003e\u003ci class=\"icon-th\"\u003e\u003c/i\u003e\u003c/span\u003e\n\u003c/div\u003e\n```\n```javascript\n$('#datepicker').datepicker();\n```\n\nAttached to non-field element, using events to work with the date values.\n\n```html\n\u003cdiv class=\"alert alert-error\" id=\"alert\"\u003e\n    \u003cstrong\u003eOh snap!\u003c/strong\u003e\n\u003c/div\u003e\n\u003ctable class=\"table\"\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n          \u003cth\u003e\n              Start date\n              \u003ca href=\"#\" class=\"btn small\" id=\"date-start\" data-date-format=\"yyyy-mm-dd\" data-date=\"2012-02-20\"\u003eChange\u003c/a\u003e\n          \u003c/th\u003e\n          \u003cth\u003e\n              End date\n              \u003ca href=\"#\" class=\"btn small\" id=\"date-end\" data-date-format=\"yyyy-mm-dd\" data-date=\"2012-02-25\"\u003eChange\u003c/a\u003e\n          \u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n          \u003ctd id=\"date-start-display\"\u003e2012-02-20\u003c/td\u003e\n          \u003ctd id=\"date-end-display\"\u003e2012-02-25\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n```\n```javascript\nvar startDate = new Date(2012,1,20);\nvar endDate = new Date(2012,1,25);\n$('#date-start')\n    .datepicker()\n    .on('changeDate', function(ev){\n        if (ev.date.valueOf() \u003e endDate.valueOf()){\n            $('#alert').show().find('strong').text('The start date must be before the end date.');\n        } else {\n            $('#alert').hide();\n            startDate = new Date(ev.date);\n            $('#date-start-display').text($('#date-start').data('date'));\n        }\n        $('#date-start').datepicker('hide');\n    });\n$('#date-end')\n    .datepicker()\n    .on('changeDate', function(ev){\n        if (ev.date.valueOf() \u003c startDate.valueOf()){\n            $('#alert').show().find('strong').text('The end date must be after the start date.');\n        } else {\n            $('#alert').hide();\n            endDate = new Date(ev.date);\n            $('#date-end-display').text($('#date-end').data('date'));\n        }\n        $('#date-end').datepicker('hide');\n    });\n```\n\nAs inline datepicker:\n\n```html\n\u003cdiv id=\"datepicker\"\u003e\u003c/div\u003e\n```\n```javascript\n$('#datepicker').datepicker();\n```\n\n\n# Using bootstrap-datepicker.js\n\nCall the datepicker via javascript:\n\n```javascript\n$('#datepicker').datepicker()\n```\n\n## Dependencies\n\nRequires bootstrap's dropdown component (`dropdowns.less`) for some styles, and bootstrap's sprites (`sprites.less` and associated images) for arrows.\n\nA standalone .css file (including necessary dropdown styles and alternative, text-based arrows) can be generated by running `build/build_standalone.less` through the `lessc` compiler:\n\n```bash\n$ lessc build/build_standalone.less datepicker.css\n```\n\n## Options\n\nAll options that take a \"Date\" can handle a `Date` object; a String formatted according to the given `format`; or a timedelta relative to today, eg '-1d', '+6m +1y', etc, where valid units are 'd' (day), 'w' (week), 'm' (month), and 'y' (year).\n\n### format\n\nString.  Default: 'mm/dd/yyyy'\n\nThe date format, combination of d, dd, D, DD, m, mm, M, MM, yy, yyyy.\n\n* d, dd: Numeric date, no leading zero and leading zero, respectively.  Eg, 5, 05.\n* D, DD: Abbreviated and full weekday names, respectively.  Eg, Mon, Monday.\n* m, mm: Numeric month, no leading zero and leading zero, respectively.  Eg, 7, 07.\n* M, MM: Abbreviated and full month names, respectively.  Eg, Jan, January\n* yy, yyyy: 2- and 4-digit years, respectively.  Eg, 12, 2012.\n\n### weekStart\n\nInteger.  Default: 0\n\nDay of the week start. 0 (Sunday) to 6 (Saturday)\n\n### startDate\n\nDate.  Default: Beginning of time\n\nThe earliest date that may be selected; all earlier dates will be disabled.\n\n### endDate\n\nDate.  Default: End of time\n\nThe latest date that may be selected; all later dates will be disabled.\n\n### daysOfWeekDisabled\n\nString, Array.  Default: '', []\n\nDays of the week that should be disabled. Values are 0 (Sunday) to 6 (Saturday). Multiple values should be comma-separated. Example: disable weekends: `'0,6'` or `[0,6]`.\n\n### autoclose\n\nBoolean.  Default: false\n\nWhether or not to close the datepicker immediately when a date is selected.\n\n### startView\n\nNumber, String.  Default: 0, 'month'\n\nThe view that the datepicker should show when it is opened.  Accepts values of 0 or 'month' for month view (the default), 1 or 'year' for the 12-month overview, and 2 or 'decade' for the 10-year overview.  Useful for date-of-birth datepickers.\n\n### todayBtn\n\nBoolean, \"linked\".  Default: false\n\nIf true or \"linked\", displays a \"Today\" button at the bottom of the datepicker to select the current date.  If true, the \"Today\" button will only move the current date into view; if \"linked\", the current date will also be selected.\n\n### todayHighlight\n\nBoolean.  Default: false\n\nIf true, highlights the current date.\n\n### keyboardNavigation\n\nBoolean.  Default: true\n\nWhether or not to allow date navigation by arrow keys.\n\n### language\n\nString.  Default: 'en'\n\nThe two-letter code of the language to use for month and day names.  These will also be used as the input's value (and subsequently sent to the server in the case of form submissions).  If an unknown language code is given, English will be used.  See I18N below.\n\n### forceParse\n\nBoolean.  Default: true\n\nWhether or not to force parsing of the input value when the picker is closed.  That is, when an invalid date is left in the input field by the user, the picker will forcibly parse that value, and set the input's value to the new, valid date, conforming to the given `format`.\n\n## Markup\n\nFormat a component.\n\n```html\n\u003cdiv class=\"input-append date\" id=\"datepicker\" data-date=\"12-02-2012\" data-date-format=\"dd-mm-yyyy\"\u003e\n    \u003cinput class=\"span2\" size=\"16\" type=\"text\" value=\"12-02-2012\"\u003e\n    \u003cspan class=\"add-on\"\u003e\u003ci class=\"icon-th\"\u003e\u003c/i\u003e\u003c/span\u003e\n\u003c/div\u003e\n```\n\n## Methods\n\n### .datepicker(options)\n\nInitializes an datepicker.\n\n### remove\n\nArguments: None\n\nRemove the datepicker.  Removes attached events, internal attached objects, and\nadded HTML elements.\n\n    $('#datepicker').datepicker('remove');\n\n### show\n\nArguments: None\n\nShow the datepicker.\n\n```javascript\n$('#datepicker').datepicker('show');\n```\n\n### hide\n\nArguments: None\n\nHide the datepicker.\n\n```javascript\n$('#datepicker').datepicker('hide');\n```\n\n### update\n\nArguments: None\n\nUpdate the datepicker with the current input value.\n\n```javascript\n$('#datepicker').datepicker('update');\n```\n\n### setStartDate\n\nArguments:\n\n* startDate (String)\n\nSets a new lower date limit on the datepicker.\n\n```javascript\n$('#datepicker').datepicker('setStartDate', '2012-01-01');\n```\n\nOmit startDate (or provide an otherwise falsey value) to unset the limit.\n\n```javascript\n$('#datepicker').datepicker('setStartDate');\n$('#datepicker').datepicker('setStartDate', null);\n```\n\n### setEndDate\n\nArguments:\n\n* endDate (String)\n\nSets a new upper date limit on the datepicker.\n\n```javascript\n$('#datepicker').datepicker('setEndDate', '2012-12-31');\n```\n\nOmit endDate (or provide an otherwise falsey value) to unset the limit.\n\n```javascript\n$('#datepicker').datepicker('setEndDate');\n$('#datepicker').datepicker('setEndDate', null);\n```\n\n### setDaysOfWeekDisabled\n\nArguments:\n\n* daysOfWeekDisabled (String|Array)\n\nSets the days of week that should be disabled.\n\n```javascript\n$('#datepicker').datepicker('setDaysOfWeekDisabled', [0,6]);\n```\n\nOmit daysOfWeekDisabled (or provide an otherwise falsey value) to unset the disabled days.\n\n```javascript\n$('#datepicker').datepicker('setDaysOfWeekDisabled');\n$('#datepicker').datepicker('setDaysOfWeekDisabled', null);\n```\n\n## Events\n\nDatepicker class exposes a few events for manipulating the dates.\n\n### show\n\nFired when the date picker is displayed.\n\n### hide\n\nFired when the date picker is hidden.\n\n### changeDate\n\nFired when the date is changed.\n\n```javascript\n$('#date-end')\n    .datepicker()\n    .on('changeDate', function(ev){\n        if (ev.date.valueOf() \u003c date-start-display.valueOf()){\n            ....\n        }\n    });\n```\n\n### changeYear\n\nFired when the *view* year is changed from decade view.\n\n### changeMonth\n\nFired when the *view* month is changed from year view.\n\n## Keyboard support\n\nThe datepicker includes some keyboard navigation:\n\n### up, down, left, right arrow keys\n\nBy themselves, left/right will move backward/forward one day, up/down will move back/forward one week.\n\nWith the shift key, up/left will move backward one month, down/right will move forward one month.\n\nWith the ctrl key, up/left will move backward one year, down/right will move forward oone year.\n\nShift+ctrl behaves the same as ctrl -- that is, it does not change both month and year simultaneously, only the year.\n\n### escape\n\nThe escape key can be used to hide and re-show the datepicker; this is necessary if the user wants to manually edit the value.\n\n### enter\n\nWhen the picker is visible, enter will simply hide it.  When the picker is not visible, enter will have normal effects -- submitting the current form, etc.\n\n## I18N\n\nThe plugin supports i18n for the month and weekday names and the `weekStart` option.  The default is English ('en'); other available translations are avilable in the `js/locales/` directory, simply include your desired locale after the plugin.  To add more languages, simply add a key to `$.fn.datepicker.dates`, before calling `.datepicker()`.  Example:\n\n```javascript\n$.fn.datepicker.dates['en'] = {\n    days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"],\n    daysShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"],\n    daysMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\", \"Su\"],\n    months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n    monthsShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n    today: \"Today\"\n};\n```\n\nRight-to-left languages may also include `rtl: true` to make the calendar display appropriately.\n\nIf your browser (or those of your users) is displaying characters wrong, chances are the browser is loading the javascript file with a non-unicode encoding.  Simply add `charset=\"UTF-8\"` to your `script` tag:\n\n```html\n\u003cscript type=\"text/javascript\" src=\"bootstrap-datepicker.XX.js\" charset=\"UTF-8\"\u003e\u003c/script\u003e\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitalets%2Fbootstrap-datepicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitalets%2Fbootstrap-datepicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitalets%2Fbootstrap-datepicker/lists"}