# Question: now in shortcodes?

**URL:** <https://discourse.gohugo.io/t/question-now-in-shortcodes/16900>\
**Category:** support\
**Created:** [February 8, 2019, 3:14pm UTC](https://discourse.gohugo.io/t/question-now-in-shortcodes/16900 "2019-02-08T15:14:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![milafrerichs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/milafrerichs/32/7778_2.png) [@milafrerichs](https://discourse.gohugo.io/u/milafrerichs)\
**Post date:** [February 8, 2019, 3:14pm UTC](https://discourse.gohugo.io/t/question-now-in-shortcodes/16900/1 "2019-02-08T15:14:17Z")

</div>

Hello,

I’m currently building another site with hugo and wanted to include some events from a data file in a shortcode (because I’m using markdown I cannot use this directly, correct?) And wanting to filter based on now.

I found this post: [Trying to filter data files based upon a date field](https://discourse.gohugo.io/t/trying-to-filter-data-files-based-upon-a-date-field/2114/8)

And thought this should work:

```
{{ range where .Site.Data.events "date" "ge" .Now }}

```

But it does not. I get the following error:

```auto
<.Now>: can't evaluate field Now in type *hugolib.ShortcodeWithPage

```

The date in the events data yams has the format:  
`date: 2019-05-15`

What am I doing wrong?  
Thanks fo your help.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [February 8, 2019, 3:29pm UTC](https://discourse.gohugo.io/t/question-now-in-shortcodes/16900/2 "2019-02-08T15:29:26Z")

</div>

Instead of

```nohighlight
.Now

```

Use

```nohighlight
now

```

> **[now](https://gohugo.io/functions/now/)**
>
> Returns the current local time

---

<div class="post-metadata">

**Author:** ![milafrerichs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/milafrerichs/32/7778_2.png) [@milafrerichs](https://discourse.gohugo.io/u/milafrerichs)\
**Post date:** [February 8, 2019, 3:32pm UTC](https://discourse.gohugo.io/t/question-now-in-shortcodes/16900/3 "2019-02-08T15:32:53Z")

</div>

thanks for the suggestion. but when I use `now` nothing is displayed.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [February 8, 2019, 3:34pm UTC](https://discourse.gohugo.io/t/question-now-in-shortcodes/16900/4 "2019-02-08T15:34:55Z")

</div>

You need to format the current date returned from `now` to match the format of your data file dates. So try:

```nohighlight
(now.Format "2006-01-02")

```

Also see [https://gohugo.io/functions/format/#hugo-date-and-time-templating-reference](https://gohugo.io/functions/format/#hugo-date-and-time-templating-reference)

---

<div class="post-metadata">

**Author:** ![milafrerichs](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/milafrerichs/32/7778_2.png) [@milafrerichs](https://discourse.gohugo.io/u/milafrerichs)\
**Post date:** [February 8, 2019, 4:27pm UTC](https://discourse.gohugo.io/t/question-now-in-shortcodes/16900/5 "2019-02-08T16:27:46Z")

</div>

thanks. more effort than I anticipated but it works 🙂
