Fixes in dates

This commit is contained in:
Antonio de la Rosa 2016-10-28 03:18:50 +02:00
parent c873d10b49
commit 92af207e31
3 changed files with 19 additions and 1 deletions

View file

@ -60,6 +60,12 @@ class DateField extends PhangoField {
$value=PhaTime\DateTime::local_to_gmt( $new_timestamp ); $value=PhaTime\DateTime::local_to_gmt( $new_timestamp );
} }
else
{
$value=PhaTime\DateTime::now();
}
} }
else if(strpos($value, '-')!==false) else if(strpos($value, '-')!==false)

View file

@ -5,6 +5,7 @@ namespace PhangoApp\PhaModels\Forms;
use PhangoApp\PhaI18n\I18n; use PhangoApp\PhaI18n\I18n;
use PhangoApp\PhaUtils\Utils; use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaTime; use PhangoApp\PhaTime;
use PhangoApp\PhaModels\CoreFields\DateField;
class DateForm extends \PhangoApp\PhaModels\Forms\BaseForm { class DateForm extends \PhangoApp\PhaModels\Forms\BaseForm {
@ -16,6 +17,15 @@ class DateForm extends \PhangoApp\PhaModels\Forms\BaseForm {
$value=$this->default_value; $value=$this->default_value;
if(gettype($value)=='array')
{
$t=new DateField('');
$value=$t->check($value);
}
settype($value, 'string'); settype($value, 'string');
if($value=='') if($value=='')

View file

@ -693,6 +693,8 @@ class Webmodel {
/** /**
* This method is used for make raw string queries. * This method is used for make raw string queries.
*
* @warning: Don't use it, use better execute method
* *
* TODO: Add an sql builder cache?. I can create a file with all cache queries and load this when i connect to database. * TODO: Add an sql builder cache?. I can create a file with all cache queries and load this when i connect to database.
*/ */