Skip to content

Commit e0ee550

Browse files
committed
Initial check-in - I'm not sure this is working as expected yet.
0 parents  commit e0ee550

File tree

12 files changed

+519
-0
lines changed

12 files changed

+519
-0
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "bower_components"
3+
}

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.idea
2+
coverage
3+
lib-cov
4+
bower_components
5+
node_modules
6+
*.seed
7+
*.log
8+
*.csv
9+
*.dat
10+
*.out
11+
*.pid
12+
*.gz
13+
*.iml
14+
15+
pids
16+
logs
17+
results
18+
19+
npm-debug.log
20+

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: node_js
2+
node_js:
3+
- "0.10"
4+
5+
branches:
6+
except:
7+
- gh-pages
8+
9+
before_install:
10+
- "export DISPLAY=:99.0"
11+
- "sh -e /etc/init.d/xvfb start"
12+
13+
before_script:
14+
- npm install -g bower grunt-cli
15+
- bower install
16+
17+
script: "grunt --verbose"

Gruntfile.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*globals module, require, process */
2+
3+
module.exports = function (grunt) {
4+
'use strict';
5+
// load all grunt tasks
6+
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
7+
8+
// Default task.
9+
grunt.registerTask('default', ['jshint', 'karma', 'coverage']);
10+
11+
var testConfig = function (configFile, customOptions) {
12+
var options = { configFile: configFile, keepalive: true };
13+
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: 'dots' };
14+
return grunt.util._.extend(options, customOptions, travisOptions);
15+
};
16+
17+
// Project configuration.
18+
grunt.initConfig({
19+
coverage: {
20+
options: {
21+
thresholds: {
22+
'statements': 100,
23+
'branches': 90,
24+
'lines': 100,
25+
'functions': 100
26+
},
27+
dir: 'coverage',
28+
root: ''
29+
}
30+
},
31+
karma: {
32+
unit: {
33+
options: testConfig('karma.conf.js')
34+
}
35+
},
36+
jshint: {
37+
files: ['src/*.js', 'test/**/*.js'],
38+
options: {
39+
curly: true,
40+
eqeqeq: true,
41+
immed: true,
42+
latedef: true,
43+
newcap: true,
44+
noarg: true,
45+
sub: true,
46+
boss: true,
47+
eqnull: true,
48+
globals: {}
49+
}
50+
}
51+
});
52+
};

LICENSE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) 2013 Dale Lotts
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Angular Date/Time input
2+
================================
3+
4+
Native AngularJS directive that allows user input of a date/time value. Valid dates are displayed in specified format, but input may be in any supported format.
5+
6+
[![Build Status](https://travis-ci.org/dalelotts/angular-date-time-input.png?branch=master)](https://travis-ci.org/dalelotts/angular-date-time-input)
7+
8+
#Dependencies
9+
10+
Requires:
11+
* AngularJS 1.1.3 or higher (Not tested with 1.0.x)
12+
* MomentJS 2.1.x or higher
13+
14+
#Testing
15+
We use karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt:
16+
17+
```
18+
npm install -g grunt-cli
19+
npm install bower grunt
20+
```
21+
22+
The karma task will try to open Chrome as a browser in which to run the tests. Make sure this is available or change the configuration in test\test.config.js
23+
24+
#Usage
25+
We use bower for dependency management. Add
26+
27+
```json
28+
dependencies: {
29+
"angular-date-time-input": "latest"
30+
}
31+
```
32+
33+
To your bower.json file. Then run
34+
35+
```html
36+
bower install
37+
```
38+
39+
This will copy the angular-date-time-input files into your components folder, along with its dependencies.
40+
41+
Load the script files in your application:
42+
```html
43+
<script type="text/javascript" src="components/moment/moment.js"></script>
44+
<script type="text/javascript" src="components/angular/angular.js"></script>
45+
<script type="text/javascript" src="components/angular-date-time-input/src/js/dateTimeInput.js"></script>
46+
```
47+
48+
Add the date module as a dependency to your application module:
49+
50+
```html
51+
var myAppModule = angular.module('MyApp', ['ui.dateTimeInput'])
52+
```
53+
54+
Apply the directive to your form elements:
55+
56+
```html
57+
<input data-date-time-input="YYYY-MMM-DD" />
58+
```
59+
60+
## Options
61+
62+
The value of the date-time-input attribute must be a valid format string. See MomentJS documentation for valid formats.

bower.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "angular-date-time-input",
3+
"version": "0.1.0",
4+
"description": "This angular directive emulates the Grails sortableColumn tag.",
5+
"author": "https://github.com/dalelotts/angular-date-time-input/graphs/contributors",
6+
"license": "MIT",
7+
"homepage": "https://github.com/dalelotts/angular-date-time-input",
8+
"main": "./src/js/sortableColumn.js",
9+
"ignore": [
10+
"**/.*",
11+
"screenshots",
12+
"node_modules",
13+
"bower_components",
14+
"test*",
15+
"demo*",
16+
"Gruntfile.js",
17+
"package.json"
18+
],
19+
"dependencies": {
20+
"angular": "~1.x",
21+
"moment": "~2.x"
22+
},
23+
"devDependencies": {
24+
"angular-mocks": "~1.x",
25+
"angular-scenario": "~1.x",
26+
"jquery": "1.10.2"
27+
}
28+
}

demo/index.html

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!DOCTYPE html>
2+
<!--[if lt IE 7]>
3+
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
4+
<!--[if IE 7]>
5+
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
6+
<!--[if IE 8]>
7+
<html class="no-js lt-ie9"> <![endif]-->
8+
<!--[if gt IE 8]><!-->
9+
<html class="no-js"> <!--<![endif]-->
10+
<head>
11+
<meta charset="utf-8">
12+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
13+
<title>Angular Bootstrap - Date Time Picker Demo</title>
14+
<base href=".."></base>
15+
<script type="text/javascript" src="bower_components/moment/moment.js"></script>
16+
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
17+
<script type="text/javascript" src="src/dateTimeInput.js"></script>
18+
<style>
19+
.ng-dirty.ng-invalid {background-color:red;}
20+
</style>
21+
</head>
22+
<body ng-app="ui.dateTimeInput">
23+
<p>You can enter dates in any format understood by moment.js, however, when you leave the field it will be displayed in
24+
the specified format.</p>
25+
26+
<p>The background of the input box will be red whenever the input is an invalid date.</p>
27+
28+
<div>
29+
<label>Please enter a date:
30+
<input data-date-time-input="M/D/YYYY" data-ng-model="data.date1"/>
31+
</label>
32+
displays as M/D/YYYY
33+
<p>Stored as: {{ data.date1 }}</p>
34+
</div>
35+
36+
<div>
37+
<label>Please enter a date:
38+
<input data-date-time-input="YYYY-MMM-DD hh:mm A}" data-ng-model="data.date2"/>
39+
</label>
40+
displays as YYYY/MMM/DD hh:mm A
41+
<p>Stored as: {{ data.date2 }}</p>
42+
</div>
43+
<div>
44+
<label>Please enter a date:
45+
<input data-date-time-input="YYYY-MMM-DD H:mm" data-ng-model="data.date3"/>
46+
</label>
47+
displays as YYYY/MMM/DD H:mm
48+
<p>Stored as: {{ data.date3 }}</p>
49+
</div>
50+
51+
<p>NB: ANY date format that moment can parse into a date will be valid input regardless of the format you specify. All of the following are valid dates.
52+
There are other date variations that are supported depending on the i18n support you loaded with moment.js</p>
53+
<ul>
54+
<li>1970-10-10</li>
55+
<li>1970-Oct-10</li>
56+
<li>1970-Oct-10 1:00 pm</li>
57+
<li>1970-Oct-10 18:00</li>
58+
<li>Oct 10</li>
59+
<li>1970 10</li>
60+
<li>70 10</li>
61+
</ul>
62+
63+
<p>Any invalid dates will have a ng-invalid class assigned by Angular</p>
64+
</body>
65+
</html>

karma.conf.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* @license angular-sortable-column
3+
* (c) 2013 Knight Rider Consulting, Inc. http://www.knightrider.com
4+
* License: MIT
5+
*/
6+
7+
/**
8+
*
9+
* @author Dale "Ducky" Lotts
10+
* @since 2013-Sep-23
11+
*/
12+
13+
files = [
14+
JASMINE,
15+
JASMINE_ADAPTER,
16+
'bower_components/jquery/jquery.js',
17+
'bower_components/moment/moment.js',
18+
'bower_components/angular/angular.js',
19+
'bower_components/angular-mocks/angular-mocks.js',
20+
'src/*.js',
21+
'test/*.spec.js'
22+
];
23+
24+
// list of files to exclude
25+
exclude = [
26+
27+
];
28+
29+
preprocessors = {
30+
'**/src/*.js': 'coverage'
31+
};
32+
33+
// test results reporter to use
34+
// possible values: 'dots', 'progress', 'junit'
35+
reporters = ['progress', 'coverage'];
36+
37+
// web server port
38+
port = 9876;
39+
40+
41+
// cli runner port
42+
runnerPort = 9100;
43+
44+
45+
// enable / disable colors in the output (reporters and logs)
46+
colors = true;
47+
48+
49+
// level of logging
50+
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
51+
logLevel = LOG_INFO;
52+
53+
54+
// enable / disable watching file and executing tests whenever any file changes
55+
autoWatch = false;
56+
57+
58+
// Start these browsers, currently available:
59+
// - Chrome
60+
// - ChromeCanary
61+
// - Firefox
62+
// - Opera
63+
// - Safari (only Mac)
64+
// - PhantomJS
65+
// - IE (only Windows)
66+
browsers = ['Chrome'];
67+
68+
69+
// If browser does not capture in given timeout [ms], kill it
70+
captureTimeout = 60000;
71+
72+
73+
// Continuous Integration mode
74+
// if true, it capture browsers, run tests and exit
75+
singleRun = true;

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "angular-date-time-input",
3+
"version": "0.1.0",
4+
"description": "This angular directive allows users to manually enter date-time values in a variety of formats but displays the date value in the specified format.",
5+
"author": "https://github.com/dalelotts/angular-date-time-input/graphs/contributors",
6+
"license": "MIT",
7+
"homepage": "https://github.com/dalelotts/angular-date-time-input",
8+
"main": "src/dateTimeInput.js",
9+
"dependencies": {},
10+
"devDependencies": {
11+
"grunt": "~0.4.1",
12+
"grunt-contrib-jshint": "~0.2.0",
13+
"grunt-istanbul-coverage": "0.0.1",
14+
"grunt-karma": "~0.4.3",
15+
"matchdep": "~0.1.1"
16+
},
17+
"scripts": {
18+
"test": "grunt --verbose"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "git://github.com/dalelotts/angular-date-time-input.git"
23+
}
24+
}

0 commit comments

Comments
 (0)