• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/fields/valuable/timeperiod.php
  • Класс: BitrixReportVisualConstructorFieldsValuableTimePeriod
  • Вызов: TimePeriod::prepareTimePeriodForMonth
private function prepareTimePeriodForMonth($value)
{
	$year = $value['year'];
	$month = $value['month'];
	$startYear = $endYear = $year;
	$startMonth = $month;
	$endMonth = $month + 1;

	if ($startMonth < 10)
	{
		$startMonth = '0' . $startMonth;
	}
	if ($endMonth < 10)
	{
		$endMonth = '0' . $endMonth;
	}
	if ($endMonth == 13)
	{
		$endYear++;
		$endMonth = '01';
	}
	$monthStartStr = $startYear . '-' . $startMonth . '-01 00:00';
	$monthEndStr = $endYear . '-' . $endMonth . '-01 00:00';
	$result = array(
		'start' => new DateTime($monthStartStr, 'Y-m-d H:i'),
		'end' => new DateTime($monthEndStr, 'Y-m-d H:i'),
	);
	return $result;
}