# Birthday banner ±4 days

**URL:** <https://community.glideapps.com/t/birthday-banner-4-days/57690>\
**Category:** Ask for Help\
**Created:** [February 9, 2023, 10:04am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690 "2023-02-09T10:04:10Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![KenApp](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@KenApp](https://community.glideapps.com/u/KenApp)\
**Post date:** [February 9, 2023, 10:04am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/1 "2023-02-09T10:04:10Z")

</div>

Hi All, I’ve done this a couple of ways but neither feel like they’re very efficient. Maybe some folks would enjoy showing me how stupid I am!!

I have users and have recorded their birthdays. I’d like to show them a happy birthday note on the welcome screen through the week of their birthday (as they may not log in on their exact birth date).

So…  
Identify that its a date thats between 4 days prior and 4 days post birth date  
Assume I’m recording their birthday as e.g. 01/01/1992

Thank you. Low priority so just wondering how other people would do it. Has to be better ways than I’m currently trying it.

---

<div class="post-metadata">

**Author:** ![glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/glide/32/53398_2.png) [@glide](https://community.glideapps.com/u/glide)\
**Post date:** [February 9, 2023, 10:04am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/2 "2023-02-09T10:04:19Z")

</div>

_This is an experimental reply from a bot. Please like it if it’s correct._

You can use the Date Range action to identify if the current date is between 4 days prior and 4 days post the user’s birthday. You can set the start date to the user’s birthday minus 4 days and the end date to the user’s birthday plus 4 days. This will return true if the current date is within the range. Learn more about the Date Range action here. [Glide • Sheets FAQ](https://www.glideapps.com/docs/reference/faq/sheets-faq)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 9, 2023, 10:22am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/3 "2023-02-09T10:22:41Z")

</div>

JavaScript to the rescue:

```auto
let today = new Date();
let birthday = new Date(p1);
let birthday_this_year = new Date(today.getFullYear(), birthday.getMonth(), birthday.getDate());
let diff = Math.abs(today.getTime() - birthday_this_year.getTime());
let diff_days = Math.ceil(diff / (1000 * 3600 * 24));
return diff_days < 4 ? true : false;

```

 ![CleanShot 2023-02-09 at 18.32.08@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/0/c05892fea01442b91ffed6dc14f131efa1ff1a5a.jpeg)

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [February 9, 2023, 10:43am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/4 "2023-02-09T10:43:06Z")

</div>

Here’s how I would do it.

**The data**

In the Users table, I would add the following 6 columns:

- Today: basic math, now
- TodayNoYear: basic math, MMDD
- Birthday: basic DateTime, probably written to via a date picker
- BirthdayNoYear: basic math, MMDD
- BirthdayNoYear-4d: basic math, subtract 4 days
- BirthdayNoYear+4d: basic math, add 4 days

 ![Screenshot 2023-02-09 at 11.38.25](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/b/fb89d916093c528a111c297cd58c7b3a3f30d87a.jpeg)

 ![Screenshot 2023-02-09 at 11.44.08](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/b/4b9783872a6e728b1a581c22749150ea011c4ce4.png)

**The filter**

The filter can be set either in the data editor in the Users table in an if-then-else column, or directly in the layout editor in the visibility options of the hint text.

In the layout editor in the visibility options:

 ![Screenshot 2023-02-09 at 11.41.07](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/3/93edc074131bf51ea4f305dbdb77c0c99f4f1a3b.jpeg)

In the data editor with an if-then-else column:

 ![Screenshot 2023-02-09 at 11.52.16](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/9/f918353a4d1f18a8c1fb180a400128869c659d19.png)

NB. In the data editor, other than the basic Birthday column, I would probably group all the computed columns under something like BirthdayBanner/ to keep the Users table organized.

---

<div class="post-metadata">

**Author:** ![KenApp](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@KenApp](https://community.glideapps.com/u/KenApp)\
**Post date:** [February 9, 2023, 10:43am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/5 "2023-02-09T10:43:40Z")

</div>

Impressive

Yep. Thats a lot better than my effort!

Thanks as always Darren. Much appreciated.

---

<div class="post-metadata">

**Author:** ![KenApp](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@KenApp](https://community.glideapps.com/u/KenApp)\
**Post date:** [February 9, 2023, 10:47am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/6 "2023-02-09T10:47:12Z")

</div>

Nice. This is very close to how was doing it. @Darren_Murphy has kinda blown it out of the water with some tidy Javascript (I’m not at all Javascript fluent).

Interesting to see how people solve it though. I nearly always get where I need to be but I often look back and think there must be better ways of doing things. Especially as the app grows. I start wondering when I’ll see the impact of my sloppy solutions!

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 9, 2023, 10:51am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/7 "2023-02-09T10:51:18Z")

</div>

In the past I would have done something very similar to the option that @nathanaelb offered up.  
And I generally try to avoid JavaScript where possible. But sometimes it’s too tempting, especially when you can save so many columns 😉

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [February 9, 2023, 10:58am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/8 "2023-02-09T10:58:10Z")

</div>

I have not been hit by the Thinh phenomenon yet 🙂

@KenApp  
Darren’s javascript is beautiful. I can vaguely read and tinker javascript, but I cannot write it, so js is out of scope for me. I still stick to the onion method of having multiple columns in the data editor.

With Darren’s javascript, the true/false value to filter on is in the data editor directly. I edited my post above should you want to do the same with an if-then-else column.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 9, 2023, 11:59pm UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/9 "2023-02-09T23:59:16Z")

</div>

> [@nathanaelb](#):
>
> Thinh phenomenon

Honored to be named haha.

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [February 10, 2023, 12:14am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/10 "2023-02-10T00:14:59Z")

</div>

The Thinh phenomena is the process whereby a nocoder slowly but gradually becomes a coder. He continues to nocode and in parallel becomes comfortable in HTML, CSS, and JavaScript. Further, C++ and Scala are around the corner.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 10, 2023, 12:16am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/11 "2023-02-10T00:16:51Z")

</div>

> [@nathanaelb](#):
>
> Further, C++ and Scala are around the corner.

On the road map, dare I say 😆

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 10, 2023, 12:22am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/12 "2023-02-10T00:22:25Z")

</div>

> [@nathanaelb](#):
>
> The Thinh phenomena is the process whereby a nocoder slowly but gradually becomes a coder.

I know [another guy](https://community.glideapps.com/u/robert_petitto/summary) that’s been inflicted with that bug 😉

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 10, 2023, 12:46am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/13 "2023-02-10T00:46:05Z")

</div>

Meanwhile, here I am using Glide so I can do less coding…

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 10, 2023, 12:47am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/14 "2023-02-10T00:47:31Z")

</div>

We’re all converging 🤣

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 10, 2023, 12:55am UTC](https://community.glideapps.com/t/birthday-banner-4-days/57690/15 "2023-02-10T00:55:12Z")

</div>

Probably not what Glide meant when they said a billion new “developers”…

I see they changed their mission statement to “creaters” instead.
