<?php
/**
 * @file
 * Contatins \Drupal\mymodule\Form
 */
namespace Drupal\mymodule\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\mymodule\Batch\Import;

class BatchForm extends FormBase {

  public function getFormId() {
    return 'mymodule_batch_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['date'] = array(
      '#type' => 'datetime',
      '#title' => 'Date and time',
    );

    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => 'Import',
      '#button_type' => 'primary',
    );
    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    #$date = $form_state->getValue('date');
    #$date = $date->getTimestamp();
    #$this->startImport();
    $import = new Import();
    $import->getNodes();
    batch_set($import->batch);
  }

  public function startImport() {
    $import = new Import();
    $import->getNodes();
    batch_set($import->batch);
  }
}
