Hey all, I’m trying to implement date-picking library combodate.js into a simple react app and as a relative beginner, i’m completely lost.
The website instructs me to include combodate, moment, and jquery onto my page with
<script src="js/jquery.js"></script>
<script src="js/moment.min.js"></script>
<script src="js/combodate.js"></script>
I’ve included these in the header of my index.html
, but unsure if this is correct as I do not have a ‘js’ folder anywhere in my app.
It also provides source code for a variety of drop down date selection formats. The one I chose reads:
<input type="text" id="datetime24" data-format="DD-MM-YYYY HH:mm" data-template="DD / MM / YYYY HH : mm" name="datetime" value="21-12-2012 20:30">
<script>
$(function(){
$('#datetime24').combodate();
});
</script>
So what I’ve done is place the above code inside the return of my render function inside my react component. I’ve imported jquery and moment into that component, but it’s unclear how to import combodate as it doesn’t look like there is any documentation on react compatibility. When I run my app, it gives me an error saying combodate()
is not a function.
I imagine this is because combodate.js (installed via bower) was installed to the folder path ./bower_components/combodate/src/combodate.js inside my app folder.
Overall - I’m unsure how and where I should be linking these library packages I’ve installed and how I should be custom tailoring the combodate code as my gut says it wasn’t written with React in mind.
Anyone have any thoughts?
Thank you!