@@ -1280,27 +1280,17 @@ SchemaBuilderEntity.prototype.prepare = function(model, dependencies) {
12801280 tmp = null ;
12811281
12821282 if ( typeval === 'string' ) {
1283- if ( val === '' )
1284- tmp = null ;
1285- else
1283+ if ( val )
12861284 tmp = val . trim ( ) . parseDate ( ) ;
1287- } else if ( typeval === 'object' ) {
1288- if ( framework_utils . isDate ( val ) )
1289- tmp = val ;
1290- else
1291- tmp = null ;
1292- } else if ( typeval === 'number' ) {
1285+ } else if ( typeval === 'number' )
12931286 tmp = new Date ( val ) ;
1294- }
1295-
1296- if ( tmp !== null && typeof ( tmp ) === 'object' && tmp . toString ( ) === 'Invalid Date' )
1297- tmp = null ;
12981287
1299- if ( tmp )
1300- item [ property ] = self . $onprepare ( property , tmp , undefined , model ) ;
1288+ if ( framework_utils . isDate ( tmp ) )
1289+ tmp = self . $onprepare ( property , tmp , undefined , model )
13011290 else
1302- item [ property ] = ( defaults ? isUndefined ( defaults ( property , false , self . name ) , null ) : null ) ;
1291+ tmp = ( defaults ? isUndefined ( defaults ( property , false , self . name ) , null ) : null ) ;
13031292
1293+ item [ property ] = tmp ;
13041294 break ;
13051295
13061296 // object
@@ -1413,23 +1403,12 @@ SchemaBuilderEntity.prototype.prepare = function(model, dependencies) {
14131403 case 5 :
14141404
14151405 if ( typeval === 'string' ) {
1416- if ( tmp === '' )
1417- tmp = null ;
1418- else
1406+ if ( tmp )
14191407 tmp = tmp . trim ( ) . parseDate ( ) ;
1420- } else if ( typeval === 'object' ) {
1421- if ( framework_utils . isDate ( tmp ) )
1422- tmp = tmp ;
1423- else
1424- tmp = null ;
1425- } else if ( typeval === 'number' ) {
1408+ } else if ( typeval === 'number' )
14261409 tmp = new Date ( tmp ) ;
1427- }
1428-
1429- if ( tmp !== null && typeof ( tmp ) === 'object' && tmp . toString ( ) === 'Invalid Date' )
1430- tmp = null ;
14311410
1432- if ( tmp )
1411+ if ( framework_utils . isDate ( tmp ) )
14331412 tmp = self . $onprepare ( property , tmp , j , model ) ;
14341413 else
14351414 tmp = undefined ;
0 commit comments