# Date math rounding error

**URL:** <https://discuss.elastic.co/t/date-math-rounding-error/261116>\
**Category:** Elasticsearch\
**Tags:** curator\
**Created:** [January 14, 2021, 11:38am UTC](https://discuss.elastic.co/t/date-math-rounding-error/261116 "2021-01-14T11:38:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbailey](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@bbailey](https://discuss.elastic.co/u/bbailey)\
**Post date:** [January 14, 2021, 11:38am UTC](https://discuss.elastic.co/t/date-math-rounding-error/261116/1 "2021-01-14T11:38:48Z")

</div>

I've come across a strange issue which I think is a bug in the date math

I create a daily snapshot of data once it is 10 days old using curator and the name of the snapshot is set to "name: \<{now/d-10d{YYYY-MM-dd}}\>"

This has been working fine until a few days ago when the name returned by the routine resolved to 2020 instead of 2021 for snapshots of data created this year.

Any suggestions ?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [January 14, 2021, 8:17pm UTC](https://discuss.elastic.co/t/date-math-rounding-error/261116/2 "2021-01-14T20:17:07Z")

</div>

Date math changed a bit recently. Which version of Elasticsearch are you using?

Also, once you're past January 11, it will be impossible to replicate with the `d-10d` part.

---

<div class="post-metadata">

**Author:** ![bbailey](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@bbailey](https://discuss.elastic.co/u/bbailey)\
**Post date:** [January 14, 2021, 10:35pm UTC](https://discuss.elastic.co/t/date-math-rounding-error/261116/3 "2021-01-14T22:35:59Z")

</div>

On the contrary, the problem has been happening every day SINCE the 11th January

---

<div class="post-metadata">

**Author:** ![bbailey](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@bbailey](https://discuss.elastic.co/u/bbailey)\
**Post date:** [January 15, 2021, 3:38pm UTC](https://discuss.elastic.co/t/date-math-rounding-error/261116/4 "2021-01-15T15:38:44Z")

</div>

It appears that the problem is fixed by changing "name: \<{now/d-10d{YYYY-MM-dd}}\>" to "name: \<{now/d-10d{yyyy-MM-dd}}\>"

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 12, 2021, 3:38pm UTC](https://discuss.elastic.co/t/date-math-rounding-error/261116/5 "2021-02-12T15:38:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
