function tpl_form_field_daterange($name, $value = array(), $time = false) {
$s = '';
if (empty($time) && !defined('TPL_INIT_DATERANGE_DATE')) {
$s = '
<script type="text/javascript">
require(["daterangepicker"], function($){
$(function(){
$(".daterange.daterange-date").each(function(){
var elm = this;
$(this).daterangepicker({
startDate: $(elm).prev().prev().val(),
endDate: $(elm).prev().val(),
format: "YYYY-MM-DD"
}, function(start, end){
$(elm).find(".date-title").html(start.toDateStr() + " 至 " + end.toDateStr());
$(elm).prev().prev().val(start.toDateStr());
$s = '';
if (empty($time) && !defined('TPL_INIT_DATERANGE_DATE')) {
$s = '
<script type="text/javascript">
require(["daterangepicker"], function($){
$(function(){
$(".daterange.daterange-date").each(function(){
var elm = this;
$(this).daterangepicker({
startDate: $(elm).prev().prev().val(),
endDate: $(elm).prev().val(),
format: "YYYY-MM-DD"
}, function(start, end){
$(elm).find(".date-title").html(start.toDateStr() + " 至 " + end.toDateStr());
$(elm).prev().prev().val(start.toDateStr());