javascripttypescriptpython-dateutilrrulerecurring-events

Implement RRule using javascript rrule.min.js


I am trying to include the library https://github.com/jakubroztocil/rrule to my webpage.

But I recieve the error: Uncaught SyntaxError: Unexpected token {

I have tried with

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script src="https://jakubroztocil.github.io/rrule/dist/es5/rrule-tz.min.js"></script>

<script>
$(document).ready(function(){

import { RRule, RRuleSet, rrulestr } from 'rrule'
alert(rrulestr('DTSTART:20120201T023000Z\nRRULE:FREQ=MONTHLY;COUNT=5')
)

});
</script>
</head>
<body>



</body>
</html>


Solution

  • Working code

    <!DOCTYPE html>
    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <script src="https://jakubroztocil.github.io/rrule/dist/es5/rrule-tz.min.js"></script>
    
    <script>
    $(document).ready(function(){
    
    alert(rrule.rrulestr('DTSTART:20120201T023000Z\nRRULE:FREQ=MONTHLY;COUNT=5'));
    
    });
    </script>
    </head>
    <body>
    
    
    
    </body>
    </html>