JSFiddle - React, Tailwind, and code Playground

by moob

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/core.js"></script>
<div>
    <button id="removeClass">Remove highlight</button>
    <div class="date">10/09/2019</div>
    <p id="para1">test test test test test test test test test test</p>
</div>

CSS

.highlight {
background: green;
}

JavaScript

$(function(){
$('#para1').addClass('highlight');

        $("#addClass").click(function () {

          $('#para1').addClass('highlight');

        });

        $("#removeClass").click(function () {

          $('#para1').removeClass('highlight');

    $('p').each(function(){
      if(this.id){(this.id = "");}
    });

        });

$(".date").each(function() {
    var diff = new Date(new Date() - Date.Parse($(this).innerText));
    var days = diff/1000/60/60/24;

    if (days > 30) {
        $(this).parent().find("p")[0].removeClass('highlight');
    }
});

});