Skip to content

Commit b88abe3

Browse files
committed
Merge branch 'feature/webpack-babel' of https://github.com/json-schema-form/angular-schema-form into feature/webpack-babel
# Conflicts: # dist/schema-form.min.js # examples/example.html
2 parents 4c7edf2 + d534f6a commit b88abe3

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

dist/schema-form.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,6 +2191,17 @@ return /******/ (function(modules) { // webpackBootstrap
21912191
value = undefined;
21922192
};
21932193

2194+
// Date fields are painful and return a date object
2195+
if (schema.type === 'string' && schema.format === 'date') {
2196+
if (value === null) {
2197+
value = undefined;
2198+
} else {
2199+
if (typeof value.toISOString === 'function') {
2200+
value = value.toISOString();
2201+
}
2202+
}
2203+
}
2204+
21942205
// Version 4 of JSON Schema has the required property not on the
21952206
// property itself but on the wrapping object. Since we like to test
21962207
// only this property we wrap it in a fake object.
@@ -3681,7 +3692,6 @@ return /******/ (function(modules) { // webpackBootstrap
36813692
});
36823693

36833694
exports.default = function (sfValidator, $parse, sfSelect) {
3684-
36853695
return {
36863696
restrict: 'A',
36873697
scope: false,

dist/schema-form.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/example.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,14 @@ <h1>Schema Form Example</h1>
142142
<div class="col-sm-4">
143143
<h3>The Generated Form</h3>
144144

145-
<form name="ngform" sf-model="modelData" sf-form="form" sf-schema="schema" ng-submit="submitForm(ngform,modelData)" sf-options="{ formDefaults: { ngModelOptions: { timezone: '+0430' } }}"></form>
146-
<!--
147145
<form name="ngform"
148146
sf-model="modelData"
149147
sf-form="form"
150148
sf-schema="schema"
151-
ng-submit="submitForm(ngform,modelData)">
149+
ng-submit="submitForm(ngform,modelData)"
150+
sf-options="{ formDefaults: { ngModelOptions: { timezone: '+0430' } }}">
152151
</form>
153-
-->
152+
154153
<div ng-show="ngform.$valid"><em>Form is valid</em></div>
155154
<div ng-show="ngform.$invalid"><em>Form is not valid</em></div>
156155

src/directives/schemaValidate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import angular from 'angular';
22

33
export default function(sfValidator, $parse, sfSelect) {
4-
54
return {
65
restrict: 'A',
76
scope: false,

src/services/validator.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ export default function() {
3737
value = undefined;
3838
};
3939

40+
// Date fields are painful and return a date object
41+
if (schema.type === 'string' && schema.format === 'date') {
42+
if (value === null) {
43+
value = undefined;
44+
}
45+
else {
46+
if (typeof value.toISOString === 'function') {
47+
value = value.toISOString();
48+
}
49+
}
50+
}
51+
4052
// Version 4 of JSON Schema has the required property not on the
4153
// property itself but on the wrapping object. Since we like to test
4254
// only this property we wrap it in a fake object.

0 commit comments

Comments
 (0)