Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
043d155
allow for custom formats
jcgertig May 20, 2016
77d941c
import not require
jcgertig May 20, 2016
ee6711d
move to export
jcgertig May 20, 2016
ab83a53
add text and fix thePicker import
jcgertig May 20, 2016
b5e4b08
update readme
jcgertig May 20, 2016
9bcf05d
rebuild
jcgertig May 20, 2016
88ee6d9
fix locale
jcgertig May 20, 2016
f2787b7
Merge pull request #1 from pklink/master
jcgertig May 24, 2016
5a399b5
updates for release
jcgertig May 24, 2016
5aa6f69
updates for release
jcgertig May 24, 2016
8b8f886
updates to when shown and when sync happens
jcgertig Jun 9, 2016
eebcdf9
handle for oldest person alive
jcgertig Jun 9, 2016
435bd59
lots of fixes
jcgertig Aug 24, 2016
a3a5eec
Add dutch locale
wingleung Oct 13, 2016
d528369
initialize month select before setting month
Oct 22, 2016
6e7ea00
Adding files with portuguese locale
lucasghizoni Nov 13, 2016
a481c0a
remove label
lucasghizoni Nov 13, 2016
fad714f
Load today button label from locales.js
lucasghizoni Nov 14, 2016
3ba7a8b
Start days of week on sunday
lucasghizoni Nov 22, 2016
878915c
Generating new build
Nov 22, 2016
6290a17
Merge pull request #6 from lucasghizoni/master
jcgertig Jan 5, 2017
beec18d
Merge pull request #5 from rflorence/master
jcgertig Jan 6, 2017
392478f
Merge branch 'master' into patch-2
jcgertig Jan 6, 2017
a2ad1e7
Merge pull request #4 from damianleung/patch-2
jcgertig Jan 6, 2017
11ce3bd
blur and dependency updates
jcgertig Jan 9, 2017
2f4295d
Merge branch 'master' of github.com:jcgertig/nodep-date-input-polyfill
jcgertig Jan 9, 2017
aba2d88
new build
jcgertig Jan 9, 2017
6060bcc
up version
jcgertig Jan 9, 2017
3eb353e
Added French localisation
sbibauw Jan 30, 2017
c46d985
Weekdays in short form
sbibauw Jan 30, 2017
c123e19
Merge pull request #7 from sbibauw/patch-1
jcgertig Mar 2, 2017
52847ff
Spanish Translations to locales
Mar 20, 2017
5744e39
Merge pull request #11 from gerardoepp/master
jcgertig Mar 20, 2017
4ec91f7
up version
jcgertig Mar 20, 2017
77ddea0
rebuild
jcgertig Mar 20, 2017
e2c9566
using "data-" prefix for "date-format" attribute name"
toddwelstein Apr 4, 2017
ef07ea2
Allow for either "date-format" or "data-date-format" attributes
toddwelstein Apr 6, 2017
ea000e4
Adjust markdown formatting
toddwelstein Apr 6, 2017
3cc757d
Another adjustment to markdown formatting
toddwelstein Apr 6, 2017
6bd200d
Added danish locale
Apr 19, 2017
b7529d6
Corrected danish today locale
Apr 19, 2017
fe5223f
Merge pull request #15 from janjhnsn/master
jcgertig Apr 24, 2017
d1b50e1
Merge pull request #13 from toddwelstein/feature/data-attribute
jcgertig Apr 24, 2017
8589b51
Add Russian and Ukrainian locales
Apr 24, 2017
188954c
Added swedish locale
May 10, 2017
942f37f
fixing valueAsDate to fix Issue #19
May 16, 2017
71c9851
generating build
May 16, 2017
75e4579
Do not sync datepicker on keyboard input
May 19, 2017
1bb7041
Fix up package.json
May 19, 2017
0bcdd88
2.14.0
May 19, 2017
52cab1f
add locales japanese
May 20, 2017
790861d
Adds event listener to hide datepicker when browser back button is pr…
May 22, 2017
33612ee
Merge pull request #1 from coverhound/jv-adds-back-button-event-listener
May 22, 2017
e4834be
2.14.1
May 22, 2017
f019e75
Modifies logic to hide datepicker when clicking back
May 22, 2017
d67c20a
Changes setInterval into onpopstate
May 22, 2017
96589cf
Merge pull request #2 from coverhound/jv-modifies-logic-for-hiding-da…
May 22, 2017
e6ad238
2.14.2
May 22, 2017
ca58fdc
Implements the following:
May 25, 2017
d6ca7dd
Merge pull request #18 from strandman/patch-1
jcgertig May 29, 2017
4de4b03
Merge branch 'master' into master
jcgertig May 29, 2017
cbcf9e0
Merge pull request #17 from VolCh/master
jcgertig May 29, 2017
05fb071
Merge pull request #21 from MasahiroKatsu/add-locales-japanese
jcgertig May 29, 2017
58ee0b6
Merge pull request #20 from fabriciojsil/master
jcgertig May 29, 2017
490c0f5
Merge branch 'master' into jv-revert-package-json-for-pr
jcgertig May 29, 2017
ac92c93
Merge pull request #24 from coverhound/jv-revert-package-json-for-pr
jcgertig May 29, 2017
db336d9
update verison and build
jcgertig May 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# nodep-date-input-polyfill
# date-input-polyfill
Just include this simple script and IE, Firefox, and OS X Safari will support `<input type="date">`, without any dependencies, not even jQuery!

Support dynamically created inputs, so can be used in single page applications.

Forked from [html5-simple-date-input-polyfill](https://www.npmjs.com/package/html5-simple-date-input-polyfill). Continuing as a separate project.
Forked from [nodep-date-input-polyfill](https://github.com/brianblakely/nodep-date-input-polyfilll). Continuing as a separate project.

## Install
`npm install --save nodep-date-input-polyfill`
`npm install --save date-input-polyfill`

Add to your project:

* **Webpack/Browserify:** `require('nodep-date-input-polyfill');`
* **Webpack/Browserify:** `require('date-input-polyfill');`

or alongside **Babel:** `import 'nodep-date-input-polyfill';`
or alongside **Babel:** `import 'date-input-polyfill';`

* **Script Tag:** Copy `nodep-date-input-polyfill.dist.js` from `node_modules` and
* **Script Tag:** Copy `date-input-polyfill.dist.js` from `node_modules` and
include it anywhere in your HTML.

* This package also supports **AMD**.

## Features
* **Easily Stylable:** [These are the default styles](https://github.com/brianblakely/nodep-date-input-polyfill/blob/master/nodep-date-input-polyfill.scss),
* **Easily Stylable:** [These are the default styles](https://github.com/jcgertig/date-input-polyfill/blob/master/date-input-polyfill.scss),
which you may override with your own.

* **Polyfills `valueAsDate` and `valueAsNumber`:**
Expand All @@ -35,6 +35,15 @@ increment/decrement the date by one day.

`<input type="date" lang="en" />`

* **Formatting:** Specify the display format by setting either the
`date-format` or `data-date-format` attribute of the `input` element. The default format is `yyyy-mm-dd`.
[Available options list.](https://github.com/felixge/node-dateformat#mask-options)

`<input type="date" date-format="mm/dd/yyyy" />`

`<input type="date" data-date-format="mm/dd/yyyy" />`


## Contributing

### Local Development
Expand Down
2 changes: 2 additions & 0 deletions date-input-polyfill.dist.js

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions date-input-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import './date-input-polyfill.scss';
import Input from './input.js';

const addPickers = () => {
Input.addPickerToOtherInputs();
// Check if type="date" is supported.
if(!Input.supportsDateInput()) {
Input.addPickerToDateInputs();
}
};

// Run the above code on any <input type="date"> in the document, also on dynamically created ones.
addPickers();

document.addEventListener(`DOMContentLoaded`, () => {
addPickers();
});

// This is also on mousedown event so it will capture new inputs that might
// be added to the DOM dynamically.
document.querySelector(`body`).addEventListener(`mousedown`, () => {
addPickers();
});
112 changes: 112 additions & 0 deletions date-input-polyfill.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
@mixin reset() {
background: #fff;
color: #000;
text-shadow: none;
border: 0;
padding: 0;
height: auto;
width: auto;
line-height: normal;
font-family: sans-serif;
font-size: 14px;
}

date-input-polyfill {
@include reset();
position: absolute !important;
text-align: center;
box-shadow: 0px 3px 10px 1px rgba(0,0,0,0.22);
cursor: default;
z-index: 1;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
overflow: hidden;
display: block;

&[data-open="false"] {
visibility: hidden;
z-index: -100 !important;
top: 0;
}
&[data-open="true"] {
visibility: visible;
}

select, table, th, td {
@include reset();
box-shadow: none;
font-family: 'Lato', Helvetica, Arial, sans-serif;
}

select, button {
border: 0;
border-radius: 0;
border-bottom: 1px solid #DADFE1;
height: 24px;
vertical-align: top;
-webkit-appearance: none;
-moz-appearance: none;
}

.monthSelect-wrapper {
width: 55%;
display: inline-block;
}

.yearSelect-wrapper {
width: 25%;
display: inline-block;
}

select {
width: 100%;

&:first-of-type {
border-right: 1px solid #DADFE1;
border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
}
}
button {
width: 20%;
background: #DADFE1;
border-radius: 0 5px 0 0;
-moz-border-radius: 0 5px 0 0;
-webkit-border-radius: 0 5px 0 0;

&:hover {
background: #eee;
}
}

table {
border-collapse: separate !important;
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
overflow: hidden;
max-width: 280px;
width: 280px;
}

th, td {
width: 32px;
padding: 4px;
text-align: center;
box-sizing: content-box;
}
td[data-day] {
cursor: pointer;


&:hover {
background: #DADFE1;
}
}
[data-selected] {
font-weight: bold;
background: #D8EAF6;
}
}
Loading