0

我有一个 AMP 日期选择器。我想在渲染 datepicer 时在 datepicker 的底部显示当前日期。

我正在尝试这样的事情。但它不显示当前日期。

<amp-date-picker
  id="departure-date-pickerOW1"
  media="(max-width: 52rem)"
  date="P0D"
  type="single"
  mode="overlay"
  layout="container"
  class="flex flex1"
  number-of-months="1"
  day-size="36"
  input-selector="[id=departure-dateOW1]"
  on="activate:AMP.setState({curr_date: departure-date- 
      pickerOW1.today})">
  <input type="text" title="departure date" id="departure-dateOW1" 
    class="date-field departure-date" placeholder="Departure date"> 
  </input>
  <span class="ico-sprites ico-calendar absolute"></span>
  <template type="amp-mustache" info-template >
    <span [text]="curr_date">current date</span>
  </template>
</amp-date-picker>
4

1 回答 1

0

尝试这样的事情:

HTML:

<input type="text" title="departure date" id="departure-dateOW1" 
class="date-field departure-date" placeholder="Departure date" value="{DATE_TODAY}> 

PHP:

 <?php 
$date = date();
$template = file_get_contents('my_template.html'); // YOUR HTML
$output  = str_replace('{DATE_TODAY}',$date, $template);
echo $output;
于 2019-03-23T09:20:16.803 回答