JSFiddle - React, Tailwind, and code Playground

by jpwo759

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/luxon/2.4.0/luxon.min.js"></script>
<script src="https://jakubroztocil.github.io/rrule/dist/es5/rrule.min.js"></script>
<div id="output">

</div>

JavaScript

function write(text){
	document.getElementById('output').innerHTML = text.toString();

}

var d = {
"1": "Monday",
"2": "Tuesday",
"3": "Wednesday",
"4": "Thrusday",
"5": "Friday",
"6": "Saturday",
"0": "Sunday",
};
var m = {
"1": "Feb",
"2": "Mar",
"3": "Apr",
"4": "May",
"5": "June",
"6": "July",
"7": "August",
"8": "September",
"9": "October",
"10": "November",
"11": "December",
"0": "January",
};

function s(str){
	var num = +str;
  if(num)
  {
  	if (num == 1) return "st"
    if (num == 2) return "nd"
    if (num == 3) return "rd"    
  }
	return "th";
}




var theDate = new Date('2022-06-29');
var weekNum = Math.ceil(theDate.getDate() / 7);

function occurance(){
	if(theDate.getDay() < 7){
  	return "first"
  }


}

write("This date is the " + weekNum + s(weekNum) + " " + d[theDate.getDay()] + " in " + m[theDate.getMonth()] + occurance());

write(luxon.DateTime.now().set({seconds:0, milliseconds:0}).toUTC().toISO({suppressMilliseconds: true, suppressSeconds:true}))

write(new RRule())