How to avoid date-picker displaying default date (12/31/1969)? - yii

I've tried defaultDate="" property but it doesn't show even if I gave some value to the date picker?
Here's my datepicker code:
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'model'=>$model,
'attribute'=>'date_healed',
'value'=>$date_healed,
'name'=>'date_healed'.$i,
// additional javascript options for the date picker plugin
'options'=>array(
//'autoSize'=>true,
'defaultDate'=>"",
'changeMonth'=>'true',
'changeYear'=>'true',
'yearRange'=>Yii::app()->params['YearRange'],
),
'htmlOptions'=>array('size'=>'10')
));

Make sure you delete default value from database table
if you see the table structure ... if you see like this, then remove '0000-00-00'
....
`date_healed` date NULL DEFAULT '0000-00-00',
....
should be...
....
`date_healed` date NULL,
....

Related

Query items of a collection before a certain date on Fauna Db?

I looked on google and tried different thing but I cannot figure out how to query all the item of a collection that have the key dueDate before the a certain Date.
On Mysql I would do something like :
select * from table_name where dueDate < "2001-01-01 00:00:00"
That query on mysql would return the items with the Date Inferior to 2001-01-01
I tried to do use that query on Fauna :
q.Map(
q.Paginate(
q.Match(q.Index(indexesQuery1)),
{ before: Date('2021-01-15T17:34:00+08:00')
} ),
q.Lambda("X", q.Get(q.Var("X"))) ) )
indexQuery1 is : getNewWordDemoIso(dueDate: Date!)
But It returns an empty Array,
Also I saved all my Date all Fauna the date format called : iso 8601
Also Im using javascript
Any ideas !?
thanks !!
When you perform an "Create", you need parse your ISOString Date for an FaunaDB Date format.
You migth need something like this:
const newTransaction = await fauna.query<TransactionObject>(
q.Create(q.Collection("transactions"), {
data: {
...transaction,
firstDueDate: q.Date(transaction.firstDueDate),
lastDueDate: q.Date(transaction.lastDueDate),
createdAt: q.ToDate(q.Now())
}
})
);
This will work for you as you said you are using JS/TS.
ps: (import {query as q} from 'faunadb')

Infusionsoft dataservice.query in Java

When trying to execute an XML request to Infusionsoft, I cannot get the dataservice.query to function properly. Basically, I have a list of "valid" tags that I would like to find out if a contact has applied to them. In the documentation it says
queryData: struct (required)
A struct containing query data. The key is the field to search on, and the value is the data to look for. % is the wild card operator and all searches are case insensitive. Below is a list of operations you can do.
Greater Than ex: LastUpdated => '~>~ 2017-01-01 00:00:00'
Greater Than or Equal to ex: LastUpdated => '~>=~ 2017-01-01 00:00:00'
Less Than ex: LastUpdated => '~<~ 2017-01-01 00:00:00'
Less Than or Equal to ex: LastUpdated => '~<=~ 2017-01-01 00:00:00'
Not Equal to ex: Id => '~<>~123'
Is Null ex: FirstName => '~null~'
IN statement ex: Id => [1,2,3,4]**
*The raw xml, will need be html encoded for '>' and '<'
**IN statements only work on Id fields and are limited to 1000 ids
But, I cannot get that in statement to work even through postman...
<member><name>GroupID</name>
<value><int>in [165,163]</int></value>
</member>
Obviously that code isn't going to work, but I hope you can see what I am trying to accomplish.
There just isn't clear documentation on how to do this OUTSIDE of PHP SDK. Any help would be appreciated.
I know this is a little old, but the correct formatting should be [165,163]. You should not include the actual work in.

Laravel 5.3 validate select input and store in database

I have a registration form and i added 3 select input for date of birth user.
Here the HTML code.
http://hastebin.com/unoxogipuj.vbs
In my RegisterController.php I've added following rules for validation.
'day' => 'required|in:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31',
'month' => 'required|in:1,2,3,4,5,6,7,8,9,10,11,12',
'year' => 'required|in:2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992',
Again in my RegisterController.php for user creation i added field for store the date in my database
'dob' => $data['day' . 'month' . 'year']
In the User Model I've added in protected fillable my field but this don't work.
You can use between:min,max here.
https://laravel.com/docs/5.3/validation#rule-between
Like:
'day' => 'required|between:1,31',
'month' => 'required|between:1,12',
'year' => 'required|between:2003,1992'
And can you please show more controller and model code?

Need Clear explanation for CHtml::dropDownList() method in yii

public static function dropDownList($name,$select,$data,$htmlOptions=array())
In this above syntax i not able to understand $select field.In yii tutorial(http://www.yiiframework.com/doc/api/1.1/CHtml#dropDownList-detail) they are said $select is selected item.but i cant able to understand.can anyone give clear example with explanation.
Let's say you have a dropdown list with the following values
$daysOfTheWeek = array(
0 => 'Monday',
1 => 'Tuesday',
2 => 'Wednesday'
3 => 'Thursday'
);
Then if you want at the beging that the selected value is Tuesday then in the widget you will put:
CHtml::dropDownList('daysOfTheWeek', '0', $daysOfTheWeek);
This is usefull when you want to edit something, since it already has an assigned value you can put it by default so the dropdown will be already filled with the previous value.

Yii dataprovider criteria for today's date

I want to display only the data in the dataprovider for today's date only. $data->timedate is the appointment date. If it is equal to the current date, display it. The following code does not work.
//today appointments dataprovider
$taProvider=new CActiveDataProvider('Appointments',array(
'sort'=>array(
'defaultOrder'=>'datetime ASC',
),
'criteria'=>array(
'condition'=>'cId=:cId',
'params'=>array(':cId'=>Yii::app()->user->id),
'condition'=>$data->timedate = date('Y-m-d'),
),
));
EDIT Modifiyed for using CDbcriteria object
You are using the PHP variables within CDbCriteria->condition. CDbCriteria Condition is nothing but the where clause in your sql query http://www.yiiframework.com/doc/api/1.1/CDbCriteria#condition-detail
Also your second assignment would overwrite the first if you need to add condition you need to use addCondition() method
Change
'criteria'=>array(
'condition'=>'cId=:cId',
'params'=>array(':cId'=>Yii::app()->user->id),
'condition'=>$data->timedate = date('Y-m-d'),
),
to
'criteria'=>array(
'condition'=>"DATE(t.timedate) = DATE(NOW()) AND cId=:cId ",
'params'=>array(':cId'=>Yii::app()->user->id),
),