# Only Show Component if it’s the First Week of the Month

> This is a solution to hide your component unless it is the first day of the month.

Source: https://tadabase.com/docs/snippets/only-show-component-if-it-s-the-first-week-of-the-month  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

![Screenshot for “Only Show Component if it’s the First Week of the Month”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/2022-09-24-10-55-23.png)

This is a solution to hide your component unless it is the first day of the month.

**One Easy Step**

**Add the following code to the JavaScript tab of the page.**

```
Date.prototype.getWeekOfMonth = function() {
  var firstWeekday = new Date(this.getFullYear(), this.getMonth(), 1).getDay();
  var offsetDate = this.getDate() + firstWeekday - 1;
  return Math.floor(offsetDate / 7);
};

TB.render('component_ID', function(data) {
    if(new Date().getWeekOfMonth() !== 0){
        data.ele.css('display','none');
    }
    
});
```

![Screenshot for “Only Show Component if it’s the First Week of the Month”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/image-1664031292714.png)

> **Note:** Remember to edit the component ID in the code above to match your component's ID. This can be found in the image below.

![Screenshot for “Only Show Component if it’s the First Week of the Month”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-09/scaled-1680-/image-1664031403523.png)

**Original Community Post:**

[Only show component if it's the first week of the month - Community Discussions / Tips and Tricks - Tadabase Community](https://community.tadabase.io/t/only-show-component-if-its-the-first-week-of-the-month/1436)
