rrule
rrule copied to clipboard
datetime is undefined and not exported from the rrule module
trafficstars
I am using [email protected] on macOS Monterey 12.5 node v16.13.2 (npm v8.1.2)
When I try to import datetime from rrule I got undefined
My import statement:
import datetime from 'rrule';
console.log('datetime', datetime);
/* !
* node_modules/rrule/dist/esm/index.js
*
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
* Based on:
* python-dateutil - Extensions to the standard Python datetime module.
* Copyright (c) 2003-2011 - Gustavo Niemeyer <[email protected]>
* Copyright (c) 2012 - Tomi Pieviläinen <[email protected]>
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/
export { RRule } from './rrule';
export { RRuleSet } from './rruleset';
export { rrulestr } from './rrulestr';
export { Frequency } from './types';
export { Weekday } from './weekday';
//# sourceMappingURL=index.js.map
I also reproduced this on runkit
https://runkit.com/ayhid/runkit-npm-rrule
I don't see datetime exported there, am I missing something here ?
It seems a lot has changed since the documentation was written! Including breaking changes around 2.7.0 according to the change log. My workaround: Do not use eg: datetime(2012, 12, 31) use new Date(Date.UTC(2012, 12 - 1, 31)) and manipulate dates with Date prototypes.
See #553