JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="row">
<div class="col-12">
<div class="table table-bordered table-hover" data-time>
<p>Просимое время: c <span data-time-value>30.11.2019 09:01</span> до <span data-time-value>30.11.2019 23:01</span></p>
</div>
</div>
</div>
</div>
JavaScript
function parseDate (str) {
var getDate = str.split(' ')[0].split('.').reverse();
var getTime = str.split(' ')[1];
var result = getDate.join(',') + ',' + getTime;
return new Date(result).getTime();
}
function checkTable () {
var infoClass = 'text-info';
var dangerClass = 'text-danger';
var $times = $('[data-time]');
$times.each(function() {
var $this = $(this);
var $times = $this.find('[data-time-value]');
$times.each(function() {
var $self = $(this);
var getDate = parseDate($self.html());
var currentDate = new Date().getTime();
if (getDate < currentDate) {
$this.addClass(infoClass)
} else if (getDate > currentDate) {
$this.addClass(dangerClass);
}
});
});
}
checkTable();