diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..2960c477 --- /dev/null +++ b/.npmignore @@ -0,0 +1,11 @@ +node_modules +examples +tests +.editorconfig +.gitattributes +.jshintrc +.npmignore +bower.json +component.json +CNAME +index.html diff --git a/CHANGELOG.md b/CHANGELOG.md index ae2e323e..49a772d9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 1.8.2 - 2020-10-22 + +- Properly parse date string, fixes #735 #755 #688 +- Cleaner packages, see #542 #580 +- Add space for XHTML, fixes #526 +- CSS fixes, see #431 #430 #809 #883 #237 #869 #869 #730 +- Add clear functionality, see #720 +- Use unique IDs, fixes #650 +- Bubble event on left arrow, fixes #710 +- Show week numbers based on ISO 8601 by default, fixes #388 #825 + +## 1.8.0 - 2018-10-17 + +- Remove testling because service is not running atm +- Move to github organisation Pikaday/Pikaday +- Add CSS-classes indicating position +- Remove the Moment.js optional dependency +- Add aria label text configuration + +## 1.7.0 - 2017-12-12 + +- Add keyboard input option, see #610 + ## 1.6.1 - 2017-06-06 - Fix memory leak, fixes #630 @@ -32,7 +55,7 @@ - Fix touch device support, see #374 - Add possibility to reset the max and min date to the date picker -## 1.3.3 - 2015-02-17 +## 1.3.3 - 2015-06-26 - Add theme class support, see #260 - Fix on iOS, see #101, #121 diff --git a/CNAME b/CNAME new file mode 100644 index 00000000..1f5eee86 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +pikaday.com diff --git a/README.md b/README.md index 70529a7f..f0301480 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,17 @@ Pikaday [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] +## ❤️ Final Update (August 2025) + +We’ve decided to archive the Pikaday repository on GitHub. The project has not been actively maintained for years. + +Pikaday was started before `` was supported in browsers and before custom elements and component frameworks. Pikaday is probably not the right choice today. + +Thank you to everyone who reported issues and contributed code :) + +* * * + +## Original README ### A refreshing JavaScript Datepicker @@ -20,8 +31,30 @@ Pikaday Also see the [changelog](CHANGELOG.md) ## Installation +You can install Pikaday as an NPM package: - npm install pikaday +```shell +npm install pikaday +``` + +Or link directly to the CDN: + +```html + +``` + +## Styles +You will also need to include Pikaday CSS file. This step depends on how Pikaday was installed. Either import from NPM: + +```css +@import './node_modules/pikaday/css/pikaday.css'; +``` + +Or link to the CDN: + +```html + +``` ## Usage @@ -89,7 +122,7 @@ You should return a string from it. Be careful, though. If the formatted string that you return cannot be correctly parsed by the `Date.parse` method (or by `moment` if it is available), then you must provide your own `parse` function in the config. This function will be passed the formatted string and the format: -`toString(dateString, format = 'YYYY-MM-DD')` +`parse(dateString, format = 'YYYY-MM-DD')` ```javascript var picker = new Pikaday({ @@ -107,8 +140,8 @@ var picker = new Pikaday({ // dateString is the result of `toString` method const parts = dateString.split('/'); const day = parseInt(parts[0], 10); - const month = parseInt(parts[1] - 1, 10); - const year = parseInt(parts[1], 10); + const month = parseInt(parts[1], 10) - 1; + const year = parseInt(parts[2], 10); return new Date(year, month, day); } }); @@ -122,6 +155,7 @@ Pikaday has many useful options: * `field` bind the datepicker to a form field * `trigger` use a different element to trigger opening the datepicker, see [trigger example][] (default to `field`) * `bound` automatically show/hide the datepicker on `field` focus (default `true` if `field` is set) +* `ariaLabel` data-attribute on the input field with an aria assistance text (only applied when `bound` is set) * `position` preferred position of the datepicker relative to the form field, e.g.: `top right`, `bottom right` **Note:** automatic adjustment may occur to avoid datepicker from being displayed outside the viewport, see [positions example][] (default to 'bottom left') * `reposition` can be set to false to not reposition datepicker within the viewport, forcing it to take the configured `position` (default: true) * `container` DOM node to render calendar into, see [container example][] (default: undefined) @@ -130,7 +164,7 @@ Pikaday has many useful options: * `toString(date, format)` function which will be used for custom formatting. This function will take precedence over `moment`. * `parse(dateString, format)` function which will be used for parsing input string and getting a date object from it. This function will take precedence over `moment`. * `defaultDate` the initial date to view when first opened -* `setDefaultDate` make the `defaultDate` the initial selected value +* `setDefaultDate` Boolean (true/false). make the `defaultDate` the initial selected value * `firstDay` first day of the week (0: Sunday, 1: Monday, etc) * `minDate` the minimum/earliest date that can be selected (this should be a native Date object - e.g. `new Date()` or `moment().toDate()`) * `maxDate` the maximum/latest date that can be selected (this should be a native Date object - e.g. `new Date()` or `moment().toDate()`) @@ -154,6 +188,18 @@ Pikaday has many useful options: * `onOpen` callback function for when the picker becomes visible * `onClose` callback function for when the picker is hidden * `onDraw` callback function for when the picker draws a new month +* `keyboardInput` enable keyboard input support (default `true`) + +### Styling + +If the `reposition` configuration-option is enabled (default), Pikaday will apply CSS-classes to the datepicker according to how it is positioned: + +* `top-aligned` +* `left-aligned` +* `right-aligned` +* `bottom-aligned` + +Note that the DOM element at any time will typically have 2 CSS-classes (eg. `top-aligned right-aligned` etc). ## jQuery Plugin @@ -177,7 +223,7 @@ $('.datepicker').eq(0).pikaday('show').pikaday('gotoYear', 2042); ## AMD support -If you use a modular script loader than Pikaday is not bound to the global object and will fit nicely in your build process. You can require Pikaday just like any other module. +If you use a modular script loader, Pikaday is not bound to the global object and will fit nicely in your build process. You can require Pikaday just like any other module. See the [AMD example][] for a full version. ```javascript @@ -244,6 +290,12 @@ Returns a [Moment.js][moment] object for the selected date (Moment must be loade Set the current selection with a [Moment.js][moment] object (see `setDate` for details). +### Clear and reset date + +`picker.clear()` + +Will clear and reset the input where picker is bound to. + ### Change current view `picker.gotoDate(new Date(2014, 1))` @@ -350,41 +402,41 @@ Also [@stas][stas] has a fork [stas/Pikaday][stas Pika], but is now quite old ## Authors -* David Bushell [http://dbushell.com][Bushell] [@dbushell][Bushell Twitter] +* David Bushell [https://dbushell.com][Bushell] [@dbushell][Bushell Twitter] * Ramiro Rikkert [GitHub][Rikkert] [@RamRik][Rikkert Twitter] Thanks to [@shoogledesigns][shoogledesigns] for the name. Copyright © 2014 David Bushell | BSD & MIT license - [Pikaday]: http://dbushell.github.com/Pikaday/ "Pikaday" + [Pikaday]: https://pikaday.com/ "Pikaday" [moment]: http://momentjs.com/ "moment.js" [browserify]: http://browserify.org/ "browserify" - [screenshot]: https://raw.github.com/dbushell/Pikaday/gh-pages/screenshot.png "Screenshot" - [issues]: https://github.com/dbushell/Pikaday/issues "Issue tracker" + [screenshot]: https://raw.github.com/Pikaday/Pikaday/master/examples/screenshot.png "Screenshot" + [issues]: https://github.com/Pikaday/Pikaday/issues "Issue tracker" [gem]: https://rubygems.org/gems/pikaday-gem "RoR gem" [mdn_date]: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date "Date" - [Bushell]: http://dbushell.com/ "dbushell.com" + [Bushell]: https://dbushell.com/ "dbushell.com" [Bushell Twitter]: https://twitter.com/dbushell "@dbushell" [Rikkert]: https://github.com/rikkert "Rikkert GitHub" [Rikkert Twitter]: https://twitter.com/ramrik "@ramrik" [shoogledesigns]: https://twitter.com/shoogledesigns/status/255209384261586944 "@shoogledesigns" - [issue1]: https://github.com/dbushell/Pikaday/issues/1 "Issue 1" - [issue18]: https://github.com/dbushell/Pikaday/issues/18 "Issue 18" + [issue1]: https://github.com/Pikaday/Pikaday/issues/1 "Issue 1" + [issue18]: https://github.com/Pikaday/Pikaday/issues/18 "Issue 18" [stas]: https://github.com/stas "@stas" [stas Pika]: https://github.com/stas/Pikaday "Pikaday" [owenmead]: https://github.com/owenmead "@owenmead" [owen Pika]: https://github.com/owenmead/Pikaday "Pikaday" [xeeali]: https://github.com/xeeali "@xeeali" [xeeali Pika]: https://github.com/xeeali/Pikaday "Pikaday" - [moment.js example]: http://dbushell.github.com/Pikaday/examples/moment.html "Pikaday w/ moment.js" - [jQuery example]: http://dbushell.github.com/Pikaday/examples/jquery.html "Pikaday w/ jQuery" - [AMD example]: http://dbushell.github.com/Pikaday/examples/amd.html "Pikaday w/ AMD" - [jQuery AMD example]: http://dbushell.github.com/Pikaday/examples/jquery-amd.html "Pikaday w/ jQuery + AMD" - [trigger example]: http://dbushell.github.com/Pikaday/examples/trigger.html "Pikaday using custom trigger" - [positions example]: http://dbushell.github.com/Pikaday/examples/positions.html "Pikaday using different position options" - [container example]: http://dbushell.github.com/Pikaday/examples/container.html "Pikaday using custom calendar container" - [theme example]: http://dbushell.github.com/Pikaday/examples/theme.html "Pikaday using multiple themes" + [moment.js example]: https://pikaday.com/examples/moment.html "Pikaday w/ moment.js" + [jQuery example]: https://pikaday.com/examples/jquery.html "Pikaday w/ jQuery" + [AMD example]: https://pikaday.com/examples/amd.html "Pikaday w/ AMD" + [jQuery AMD example]: https://pikaday.com/examples/jquery-amd.html "Pikaday w/ jQuery + AMD" + [trigger example]: https://pikaday.com/examples/trigger.html "Pikaday using custom trigger" + [positions example]: https://pikaday.com/examples/positions.html "Pikaday using different position options" + [container example]: https://pikaday.com/examples/container.html "Pikaday using custom calendar container" + [theme example]: https://pikaday.com/examples/theme.html "Pikaday using multiple themes" diff --git a/bower.json b/bower.json index 6e821cf8..e7b20083 100755 --- a/bower.json +++ b/bower.json @@ -14,15 +14,17 @@ "ignore": [ "**/.*", "node_modules", - "components" + "components", + "examples", + "tests" ], "license" : [ "0BSD", "MIT" ], - "homepage": "http://dbushell.github.io/Pikaday/", + "homepage": "https://pikaday.com", "repository": { "type": "git", - "url": "https://github.com/dbushell/Pikaday.git" + "url": "https://github.com/Pikaday/Pikaday.git" } } diff --git a/component.json b/component.json index e4f6e937..b6b9163f 100755 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "pikaday", "repo": "dbushell/Pikaday", "description": "A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS", - "version": "1.6.1", + "version": "1.8.2", "keywords": [ "datepicker", "calendar", @@ -12,6 +12,6 @@ "scripts": ["pikaday.js"], "styles": ["css/pikaday.css"], "dependencies": {}, - "demo": "http://dbushell.github.io/Pikaday/", + "demo": "https://pikaday.com", "license": "MIT" } diff --git a/css/pikaday.css b/css/pikaday.css index 1759061f..3dbce2a0 100755 --- a/css/pikaday.css +++ b/css/pikaday.css @@ -2,7 +2,7 @@ /*! * Pikaday - * Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/ + * Copyright © 2014 David Bushell | BSD & MIT license | https://dbushell.com/ */ .pika-single { @@ -26,7 +26,6 @@ http://nicolasgallagher.com/micro-clearfix-hack/ display: table; } .pika-single:after { clear: both } -.pika-single { *zoom: 1 } .pika-single.is-hidden { display: none; @@ -50,7 +49,6 @@ http://nicolasgallagher.com/micro-clearfix-hack/ .pika-label { display: inline-block; - *display: inline; position: relative; z-index: 9999; overflow: hidden; @@ -68,7 +66,6 @@ http://nicolasgallagher.com/micro-clearfix-hack/ margin: 0; left: 0; top: 5px; - filter: alpha(opacity=0); opacity: 0; } @@ -91,8 +88,6 @@ http://nicolasgallagher.com/micro-clearfix-hack/ background-repeat: no-repeat; background-size: 75% 75%; opacity: .5; - *position: absolute; - *top: 0; } .pika-prev:hover, @@ -104,14 +99,12 @@ http://nicolasgallagher.com/micro-clearfix-hack/ .is-rtl .pika-next { float: left; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg=='); - *left: 0; } .pika-next, .is-rtl .pika-prev { float: right; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII='); - *right: 0; } .pika-prev.is-disabled, @@ -122,7 +115,6 @@ http://nicolasgallagher.com/micro-clearfix-hack/ .pika-select { display: inline-block; - *display: inline; } .pika-table { @@ -159,8 +151,9 @@ http://nicolasgallagher.com/micro-clearfix-hack/ color: #666; font-size: 12px; line-height: 15px; - text-align: right; + text-align: center; background: #f5f5f5; + height: initial; } .pika-week { @@ -236,4 +229,3 @@ http://nicolasgallagher.com/micro-clearfix-hack/ border-bottom: none; cursor: help; } - diff --git a/examples/amd.html b/examples/amd.html index 74835b5c..8550df21 100755 --- a/examples/amd.html +++ b/examples/amd.html @@ -9,7 +9,7 @@
-
+
Since version 1.0 Pikaday is a stable and battle tested date-picker. Feel free to use it however you like but please report any bugs or feature requests to the GitHub issue tracker, thanks!
+Since version 1.0 Pikaday is a stable and battle tested date-picker. Feel free to use it however you like but please report any bugs or feature requests to the GitHub issue tracker, thanks!
-Copyright © 2014 David Bushell | BSD & MIT license | Example by Ramiro Rikkert
+Copyright © 2014 David Bushell | BSD & MIT license | Example by Ramiro Rikkert
-