{{> "_issues-facet-header"}}

{{#if createdAt}}
  <input type="hidden" name="createdAt">
  <div class="search-navigator-facet-container">
    {{dt createdAt}} ({{fromNow createdAt}})
  </div>
{{else}}
  <div class="search-navigator-facet-container">
    <div class="js-barchart" data-height="75" {{#if periodEnd}}data-end-date="{{periodEnd}}"{{/if}}></div>
    <div class="search-navigator-date-facet-selection">
      <a class="js-select-period-start search-navigator-date-facet-selection-dropdown-left">
        {{#if periodStart}}{{d periodStart}}{{else}}Past{{/if}}&nbsp;<i class="icon-dropdown"></i>
      </a>
      <a class="js-select-period-end search-navigator-date-facet-selection-dropdown-right">
        {{#if periodEnd}}{{d periodEnd}}{{else}}Now{{/if}}&nbsp;<i class="icon-dropdown"></i>
      </a>
      <input class="js-period-start search-navigator-date-facet-selection-input-left"
             type="text" value="{{#if periodStart}}{{ds periodStart}}{{/if}}" name="createdAfter">
      <input class="js-period-end search-navigator-date-facet-selection-input-right"
             type="text" value="{{#if periodEnd}}{{ds periodEnd}}{{/if}}" name="createdBefore">
    </div>

    <div class="spacer-top">
      <span class="spacer-right">{{t "issues.facet.createdAt.or"}}</span>
      <a class="js-all spacer-right" href="#">{{t "issues.facet.createdAt.all"}}</a>
      <a class="js-last-week spacer-right {{#eq createdInLast "1w"}}active-link{{/eq}}" href="#">{{t "issues.facet.createdAt.last_week"}}</a>
      <a class="js-last-month spacer-right {{#eq createdInLast "1m"}}active-link{{/eq}}" href="#">{{t "issues.facet.createdAt.last_month"}}</a>
      <a class="js-last-year {{#eq createdInLast "1y"}}active-link{{/eq}}" href="#">{{t "issues.facet.createdAt.last_year"}}</a>
    </div>
  </div>
{{/if}}
