Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for showWeekNumbers, minDate, maxDate, disableOther and some style changes #61

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ There are a number of options that be configured inline with attributes. Here ar
| hover-text | null | Hover text for button. |
| icon-class | null | If set, `<i class='some-class'></i>` will be prepended inside the button |
| disable-timepicker | false | If true, the timepicker will be disabled and the default label format will be just the date |
| disable-other | false | If true, dates from other months will be disabled in the calendar |
| disable-clear-button | false | If true, the clear button will be removed |
| on-change | null | Set to a function that will be called when the date is changed |
| default-time | null | Time that will be set when you click on a date on the calendar. Must be in 24-hour format. |
| init-value | null | Set the initial value of the date inline as a string. Will be immediately parsed and set as the value of your model.|
| date-filter | null | Set to a function to enable/disable dates. Useful for disabling weekends, etc. [See more below](#date-filter-function) |
| show-week-numbers | false | If true, show week numbers in the calendar. |
| min-date | null | If set, denotes the minimum date allowed to be selected. Dates before minDate will be disabled |
| max-date | null | If set, denotes the maximum date allowed to be selected. Dates after maxDate will be disabled |


**Example:**

Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngQuickDate",
"version": "1.3.0",
"version": "1.4.0",
"main": ["dist/ng-quick-date.js", "dist/ng-quick-date.css", "dist/ng-quick-date-default-theme.css"],
"ignore": [
"bower_components",
Expand All @@ -14,10 +14,10 @@
"screenshot.png"
],
"dependencies": {
"angular": "~1.2.0"
"angular": "~1.4.0"
},
"devDependencies": {
"angular-mocks": "~1.2.0",
"angular-mocks": "~1.4.0",
"jasmine": "~1.3.1",
"karma-jasmine": "~0.1.3",
"jquery": "~2.0"
Expand Down
21 changes: 17 additions & 4 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<form name='date_form' novalidate>
<p>
<label>My Date</label>
<quick-datepicker name='myDate' ng-model='myDate' required></quick-datepicker>
<quick-datepicker name='myDate' ng-model='myDate' min-date='minDate' max-date='maxDate' required></quick-datepicker>
</p>
<p>
<label>Some other field</label>
Expand All @@ -23,22 +23,35 @@
</form>
<br/>
<br/>
<a href='' ng-click='setToToday()'>Set Date to Today</a>
<a href='' ng-click='setToToday()'>Set Date to Today</a><br/>
<a href='' ng-click='setMinDate()'>Set Min Date To Today</a><br/>
<a href='' ng-click='setMaxDate()'>Set Max Date To Today</a><br/>
</div>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<!-- <script type='text/javascript' src='vendor/sugar.js' /> -->
<!-- <script type='text/javascript' src='vendor/date.js' /> -->
<!-- <script type='text/javascript' src='bower_components/jquery/jquery.js' /> -->
<script type="text/javascript" src="dist/ng-quick-date.js"></script>
<script type='text/javascript' src='dist/ng-quick-date.js'></script>
<script type='text/javascript'>
var app = angular.module("ngQuickDateDemo", ["ngQuickDate"]);
app.config(function(ngQuickDateDefaultsProvider) {
return ngQuickDateDefaultsProvider.set({
showWeekNumbers: true,
disableTimepicker: true,
disableOther: true
});
});
app.controller("DemoCtrl", function($scope) {
$scope.myDate = null
$scope.setToToday = function() { $scope.myDate = new Date(); }
$scope.minDate = null
$scope.maxDate = null

var today = new Date();
today = new Date(today.getFullYear(), today.getMonth(), today.getDate());

$scope.setToToday = function() { $scope.myDate = today; }
$scope.setMinDate = function() { $scope.minDate = today; }
$scope.setMaxDate = function() { $scope.maxDate = today; }
});
</script>
</body>
Expand Down
17 changes: 13 additions & 4 deletions dist/ng-quick-date-default-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,23 @@
.quickdate-prev-month i {
padding-right: 10px;
}
table.quickdate-calendar {
border: solid 1px #ccc;
table.quickdate-calendar-wrapper {
width: 100%;
}
table.quickdate-calendar-weeks {
border: none;
}
table.quickdate-calendar-weeks td {
border: 1px solid #ccc;
background-color: #ffffff;
}
table.quickdate-calendar {
border: none;
}
table.quickdate-calendar th,
table.quickdate-calendar td {
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
background-color: #ffffff;
border: 1px solid #ccc;
}
table.quickdate-calendar td:hover {
background-color: #e6e6e6;
Expand Down
42 changes: 35 additions & 7 deletions dist/ng-quick-date-plus-default-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,26 @@ a.quickdate-next-month {
.quickdate-text-inputs {
text-align: left;
margin-bottom: 5px;
display: table;
table-layout: fixed;
width: 100%;
}
.quickdate-input-wrapper {
width: 48%;
display: inline-block;
display: table-cell;
padding-left: 2px;
}
.quickdate-input-wrapper:first-child {
padding-left: 0;
}
input.quickdate-date-input,
input.quickdate-time-input {
width: 100px;
width: 100%;
margin: 0;
height: auto;
padding: 2px 3px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
table.quickdate-calendar {
border-collapse: collapse;
Expand All @@ -78,6 +87,16 @@ table.quickdate-calendar td {
table.quickdate-calendar td:hover {
cursor: pointer;
}
table.quickdate-calendar-weeks {
border-collapse: collapse;
border-spacing: 0;
margin-top: 5px;
margin-right: 10px;
}
table.quickdate-calendar-weeks th,
table.quickdate-calendar-weeks td {
padding: 5px;
}
.quickdate-popup-footer {
text-align: right;
display: block;
Expand Down Expand Up @@ -138,14 +157,23 @@ table.quickdate-calendar td:hover {
.quickdate-prev-month i {
padding-right: 10px;
}
table.quickdate-calendar {
border: solid 1px #ccc;
table.quickdate-calendar-wrapper {
width: 100%;
}
table.quickdate-calendar-weeks {
border: none;
}
table.quickdate-calendar-weeks td {
border: 1px solid #ccc;
background-color: #ffffff;
}
table.quickdate-calendar {
border: none;
}
table.quickdate-calendar th,
table.quickdate-calendar td {
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
background-color: #ffffff;
border: 1px solid #ccc;
}
table.quickdate-calendar td:hover {
background-color: #e6e6e6;
Expand Down
25 changes: 22 additions & 3 deletions dist/ng-quick-date.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,26 @@ a.quickdate-next-month {
.quickdate-text-inputs {
text-align: left;
margin-bottom: 5px;
display: table;
table-layout: fixed;
width: 100%;
}
.quickdate-input-wrapper {
width: 48%;
display: inline-block;
display: table-cell;
padding-left: 2px;
}
.quickdate-input-wrapper:first-child {
padding-left: 0;
}
input.quickdate-date-input,
input.quickdate-time-input {
width: 100px;
width: 100%;
margin: 0;
height: auto;
padding: 2px 3px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
table.quickdate-calendar {
border-collapse: collapse;
Expand All @@ -78,6 +87,16 @@ table.quickdate-calendar td {
table.quickdate-calendar td:hover {
cursor: pointer;
}
table.quickdate-calendar-weeks {
border-collapse: collapse;
border-spacing: 0;
margin-top: 5px;
margin-right: 10px;
}
table.quickdate-calendar-weeks th,
table.quickdate-calendar-weeks td {
padding: 5px;
}
.quickdate-popup-footer {
text-align: right;
display: block;
Expand Down
Loading