What you want isn't possible by ONLY using the query string parameters. However, you can create a function in your theme or a plugin that checks for the presence of a start_date and end_date parameter, for instance, and modify the query appropriately.
You'd want to add these functions as a filter to 'pre_get_posts', and check for the presence of the those two new parameters you'd create. Something like this, added to your theme's functions.php file should do it:
//Add in our new custom query vars first
function add_query_vars_filter( $vars ){
$vars[] = "end_date";
$vars[] = "start_date";
return $vars;
}
add_filter( 'query_vars', 'add_query_vars_filter' );
function parse_date_range_query_string( $query ){
$start_date = get_query_var('start_date', 1900);
$end_date = get_query_var('end_date', date("Y"));
if (!is_admin()) {
$query->set('date_query', array(
array(
'after' => array(
'year' => $start_date,
'month' => 1,
'day' => 1
),
'before' => array(
'year' => $end_date,
'month' => 12,
'day' => 31
),
'inclusive' => true
),
)
);
}
}
add_filter( 'pre_get_posts', 'parse_date_range_query_string' );
Now, a url like example.com/?start_date=2014&end_date=2016 should work
UPDATE: How would this work with a YYYY-MM-DD formatted string? Slight change, as the date_query before and after parameters can take a timestamp string instead of the year,month,day array I used above. You'd just change the function to something like the following:
function parse_date_range_query_string( $query ){
$start_date = get_query_var('start_date', '1900-01-01');
$end_date = get_query_var('end_date', date("Y-m-d"));
if (!is_admin()) {
$query->set('date_query', array(
array(
'after' => $start_date,
'before' => $end_date,
'inclusive' => true
),
)
);
}
}