Yii
3
Вклад в тег
function textToDate(txt) {
if (txt == 'week') {
var startOfWeek = moment().startOf('week').format('DD.MM.YYYY');
var endOfWeek = moment().endOf('week').format('DD.MM.YYYY');
return startOfWeek + ' - ' + endOfWeek;
}
else if (txt == 'day') {
var startOfWeek = moment().startOf('day').format('DD.MM.YYYY');
return startOfWeek;
}
else if (txt == 'lastday') {
var startOfWeek = moment().subtract(1, 'day').startOf('day').format('DD.MM.YYYY');
return startOfWeek;
}
else if (txt == 'hour') {
var startOfWeek = moment().startOf('hour').format('DD.MM.YYYY HH:00');
var endOfWeek = moment().startOf('hour').add(1, 'hour').format('HH:00');
return startOfWeek + ' - ' + endOfWeek;
}
else if (txt == 'lastweek') {
var startOfWeek = moment().subtract(1, 'week').startOf('week').format('DD.MM.YYYY');
var endOfWeek = moment().subtract(1, 'week').endOf('week').format('DD.MM.YYYY');
return startOfWeek + ' - ' + endOfWeek;
}
else if (txt == 'month') {
var startOfWeek = moment().startOf('month').format('DD.MM.YYYY');
var endOfWeek = moment().endOf('month').format('DD.MM.YYYY');
return startOfWeek + ' - ' + endOfWeek;
}
else if (txt == 'lastmonth') {
var startOfWeek = moment().subtract(1, 'month').startOf('month').format('DD.MM.YYYY');
var endOfWeek = moment().subtract(1, 'month').endOf('month').format('DD.MM.YYYY');
return startOfWeek + ' - ' + endOfWeek;
}
else
return txt;
}
<?php
use yii\db\Migration;
class m160322_045630_add_catalog_data extends Migration {
public function safeUp()
{
Yii::$app->db->createCommand()->batchInsert('country', ['name'], [
['Австралия'],
['Австрия'],
['Азербайджан'],
['Албания'],
])->execute();
}
public function safeDown()
{
Yii::$app->db->createCommand()->delete('country', ['in', 'name', ['Австралия', 'Австрия', 'Азербайджан', 'Албания']]
)->execute();
}
<script type="text/javascript" src="/js/bootstrap-datepicker.js"></script>
<input id="date" type="text" name="dat1" class="date" maxlength=50 size=25% />
<script>
$(function () {
$('#date').datepicker({
language: "ru",
selectWeek: true,
format: "dd.mm.yyyy",
autoclose: true,
todayHighlight: true});
var queryDate = "<?php echo "$mn" ?>";
$('#date').datepicker('setDate', queryDate);
$('#date').datepicker()
.on('changeDate', function (ev) {
document.getElementById('newFormAdv').submit();
});
});
</script>