Socket
Socket
Sign inDemoInstall

angular-ui-date

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta.3 to 1.0.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="1.0.0"></a>
# [1.0.0](https://github.com/angular-ui/ui-date/compare/1.0.0-beta.3...v1.0.0) (2016-02-18)
### Bug Fixes
* **ui-date:** Validator is ok for blank or null dates ([93e6141](https://github.com/angular-ui/ui-date/commit/93e6141))
<a name="1.0.0-beta.0"></a>

@@ -2,0 +12,0 @@ # [1.0.0-beta.0](https://github.com/angular-ui/ui-date/compare/0.0.11...v1.0.0-beta.0) (2015-12-09)

2

package.json
{
"name": "angular-ui-date",
"version": "1.0.0-beta.3",
"version": "1.0.0",
"description": "This directive allows you to add a date-picker to your form elements.",

@@ -5,0 +5,0 @@ "main": "dist/date.js",

@@ -29,18 +29,26 @@ # ui-date directive [![Build Status](https://travis-ci.org/angular-ui/ui-date.svg)](https://travis-ci.org/angular-ui/ui-date)

<link rel="stylesheet" href="bower_components/jquery-ui/themes/smoothness/jquery-ui.css"/>
```html
<link rel="stylesheet" href="bower_components/jquery-ui/themes/smoothness/jquery-ui.css"/>
```
Load the script files in your application:
<script type="text/javascript" src="bower_components/jquery/jquery.js"></script>
<script type="text/javascript" src="bower_components/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-ui-date/dist/date.js"></script>
```html
<script type="text/javascript" src="bower_components/jquery/jquery.js"></script>
<script type="text/javascript" src="bower_components/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-ui-date/dist/date.js"></script>
```
Add the date module as a dependency to your application module:
angular.module('MyApp', ['ui.date'])
```js
angular.module('MyApp', ['ui.date'])
```
Apply the directive to your form elements:
<input ui-date>
```html
<input ui-date>
```

@@ -51,11 +59,15 @@ ## Options

myAppModule.controller('MyController', function($scope) {
$scope.dateOptions = {
changeYear: true,
changeMonth: true,
yearRange: '1900:-0'
};
});
```js
myAppModule.controller('MyController', function($scope) {
$scope.dateOptions = {
changeYear: true,
changeMonth: true,
yearRange: '1900:-0'
};
});
```
```html
<input ui-date="dateOptions" name="DateOfBirth">
```

@@ -66,3 +78,5 @@ ## Static Inline Picker

<div ui-date="dateOptions" name="DateOfBirth"></div>
```html
<div ui-date="dateOptions" name="DateOfBirth"></div>
```

@@ -84,7 +98,11 @@ ## Working with ng-model

<input ui-date ui-date-format="DD, d MM, yy" ng-model="myDate">
```html
<input ui-date ui-date-format="DD, d MM, yy" ng-model="myDate">
```
Now you can set myDate in the controller.
$scope.myDate = "Thursday, 11 October, 2012";
```js
$scope.myDate = "Thursday, 11 October, 2012";
```

@@ -97,5 +115,6 @@ ## ng-required directive

<div ui-date="dateOptions" name="DateOfBirth" ng-required="true"></div>
```html
<div ui-date="dateOptions" name="DateOfBirth" ng-required="true"></div>
```
## Usage with webpack

@@ -102,0 +121,0 @@

@@ -14,4 +14,4 @@ import jQuery from 'jquery';

function dateToString(dateFormat, value) {
dateFormat = dateFormat || uiDateFormatConfig;
function dateToString(uiDateFormat, value) {
var dateFormat = uiDateFormat || uiDateFormatConfig;
if (value) {

@@ -142,4 +142,6 @@ if (dateFormat) {

controller.$validators.uiDateValidator = function uiDateValidator(modelValue, viewValue) {
return angular.isDate(uiDateConverter.stringToDate(attrs.uiDateFormat, viewValue));
controller.$validators.uiDateValidator = function uiDateValidator(modelValue, viewValue) {
return viewValue === null
|| viewValue === ''
|| angular.isDate(uiDateConverter.stringToDate(attrs.uiDateFormat, viewValue));
};

@@ -146,0 +148,0 @@

@@ -436,2 +436,25 @@ import $ from 'jquery';

});
it('should validate null and blank dates as valid', function() {
inject(function($compile, $rootScope) {
var element = $compile('<form name="testForm"><input name="optionalDate" ui-date="{dateFormat: \'yy-mm-dd\'}" ng-required="false" ng-model="x"/></form>')($rootScope);
var ngModel = element.find('input').controller('ngModel');
ngModel.$setViewValue('');
expect($rootScope.testForm.$error).toEqual({});
})
});
// it('should validate null and blank dates as valid', function() {
// inject(function($compile, $rootScope) {
// $rootScope.x = null;
// var element = $compile('<form name="testForm"><input name="optionalDate" ui-date="{dateFormat: \'yy-mm-dd\'}" ng-required="false" ng-model="x"/></form>')($rootScope);
// expect($rootScope.testForm.$error).toEqual({});
//
// element.find('input').val('09-99-99').triggerHandler('input');
// expect($rootScope.testForm.$error).toEqual({});
// })
// });
});

@@ -438,0 +461,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc