jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
https://jkbrzt.github.io/rrule
Other
3.24k stars 506 forks source link

datetime is undefined and not exported from the rrule module #551

Open ayhid opened 1 year ago

ayhid commented 1 year ago

I am using rrule@2.7.1 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);
Capture d’écran 2022-08-21 à 20 39 06

/* !
 * 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 <gustavo@niemeyer.net>
 * Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
 * 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 ?

JayNaire commented 1 year ago

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.

1ed commented 1 year ago

See #553