# Recurring date is showing wrong next date

**URL:** https://meta.discourse.org/t/recurring-date-is-showing-wrong-next-date/173852
**Category:** Bug
**Created:** [December 20, 2020, 4:26pm UTC](https://meta.discourse.org/t/recurring-date-is-showing-wrong-next-date/173852 "2020-12-20T16:26:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [December 20, 2020, 4:26pm UTC](https://meta.discourse.org/t/recurring-date-is-showing-wrong-next-date/173852/1 "2020-12-20T16:26:54Z")

</div>

I’m trying to set up a recurring date as follows:

```plaintext
[date=2021-01-24 time=08:30:00 timezone="America/New_York" recurring="1.weeks"]

```

Since this date is in the future, it should show January 24, 2021 as the next occurrence. Instead, it’s showing February 28, 2021.

Actual date:  
2021-01-24T13:30:00Z

Screenshot from post preview (in case the preview shows it differently):  
 ![image](https://global.discourse-cdn.com/meta/original/3X/0/1/013c23f2d689e97f3b9ad2c9f858fcd02e0eb596.png)

* * *

Changing the date to 2021-01-25 jumps the date all the way to March 8, 2021, skipping 8 days instead of 1 day. Every 7th day it jumps an extra week, which seems to be why the date is so off. Am I doing something wrong here? Maybe there’s an edge case with creating recurring dates that are in the future in general or in a future year specifically.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [December 22, 2020, 7:47pm UTC](https://meta.discourse.org/t/recurring-date-is-showing-wrong-next-date/173852/2 "2020-12-22T19:47:20Z")

</div>

This seems oddly intentional from the code. It always seems to base the recurring date off the different between the _current_ date and today:

[https://github.com/discourse/discourse/blob/master/plugins/discourse-local-dates/assets/javascripts/lib/local-date-builder.js.es6#L55](https://github.com/discourse/discourse/blob/master/plugins/discourse-local-dates/assets/javascripts/lib/local-date-builder.js.es6#L55)

I tried changing this in the code to be `localDate.datetime` and the output was correct in the browser but 4 tests failed. It seemed they were ensuring it works this way, so now I’m wondering if I’m missing something @j.jaffeux? Recurring should be after the date you entered not the current date right?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 22, 2020, 7:49pm UTC](https://meta.discourse.org/t/recurring-date-is-showing-wrong-next-date/173852/4 "2020-12-22T19:49:21Z")

</div>

Yes indeed I think I have overlooked this case and mostly took into consideration when you try to create a date in past and recurring will make it happen in future. Will have a look next week.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 28, 2020, 8:32am UTC](https://meta.discourse.org/t/recurring-date-is-showing-wrong-next-date/173852/6 "2020-12-28T08:32:05Z")

</div>

This is awaiting review, but that should fix it once merged:

[https://github.com/discourse/discourse/pull/11587](https://github.com/discourse/discourse/pull/11587)

Thanks for the report, I’m happy to have this bug out of the way.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [January 2, 2021, 10:01am UTC](https://meta.discourse.org/t/recurring-date-is-showing-wrong-next-date/173852/7 "2021-01-02T10:01:54Z")

</div>


