async def test_statistics_during_period_bad_end_time(hass, hass_ws_client):
    'Test statistics_during_period.'
    now = dt_util.utcnow()
    (await hass.async_add_executor_job(init_recorder_component, hass))
    (await async_setup_component(hass, 'history', {'history': {}}))
    (await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE].block_till_done))
    client = (await hass_ws_client())
    (await client.send_json({'id': 1, 'type': 'history/statistics_during_period', 'start_time': now.isoformat(), 'end_time': 'dogs'}))
    response = (await client.receive_json())
    assert (not response['success'])
    assert (response['error']['code'] == 'invalid_end_time')
Test statistics_during_period.
async def test_statistics_during_period_bad_end_time(hass, hass_ws_client):
    
    now = dt_util.utcnow()
    (await hass.async_add_executor_job(init_recorder_component, hass))
    (await async_setup_component(hass, 'history', {'history': {}}))
    (await hass.async_add_executor_job(hass.data[recorder.DATA_INSTANCE].block_till_done))
    client = (await hass_ws_client())
    (await client.send_json({'id': 1, 'type': 'history/statistics_during_period', 'start_time': now.isoformat(), 'end_time': 'dogs'}))
    response = (await client.receive_json())
    assert (not response['success'])
    assert (response['error']['code'] == 'invalid_end_time')