From d7b2d99a89668818b363af40494e2d5d620cf34d Mon Sep 17 00:00:00 2001 From: David Golightly Date: Sun, 10 Jul 2022 18:47:04 -0700 Subject: [PATCH 01/15] update changelog --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ff5e95..fed80fa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,20 @@ ### Changelog +- 2.7.1 (2022-07-10) + + - Internal: + - Upgrade build dependencies (#515) + - Migrate from tslint to eslint (#514) + - Fix precommit & lint warnings (#519) + - Fix invalid date formats in tests (#517) + - Remove default exports (#513) + - Point to esm correctly (#516) + - 2.7.0 (2022-06-05) - Features: - **BREAKING CHANGE** Removes default export in favor of named exports - - Removes Luxon dependency + - Removes Luxon dependency (#508) - 2.6.8 (2021-02-04) From 4bfeaef16b6c2dd4fcfa2b1a8be9628ebe927d4f Mon Sep 17 00:00:00 2001 From: David Golightly Date: Sun, 10 Jul 2022 18:51:40 -0700 Subject: [PATCH 02/15] v2.7.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8715fe07..6a92e46c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rrule", - "version": "2.7.0", + "version": "2.7.1", "description": "JavaScript library for working with recurrence rules for calendar dates.", "homepage": "http://jakubroztocil.github.io/rrule/", "license": "BSD-3-Clause", From 1853e2fd0baada1f108085fc92b4dab23f22c2bc Mon Sep 17 00:00:00 2001 From: Zearin Date: Sun, 24 Jul 2022 14:19:19 -0400 Subject: [PATCH 03/15] Update README.md Minor copy-edits and formatting tweaks --- README.md | 115 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 45e9139f..c8e1c430 100644 --- a/README.md +++ b/README.md @@ -175,9 +175,9 @@ Dates in JavaScript are tricky. `RRule` tries to support as much flexibility as By default, `RRule` deals in ["floating" times or UTC timezones](https://tools.ietf.org/html/rfc5545#section-3.2.19). If you want results in a specific timezone, `RRule` also provides [timezone support](#timezone-support). Either way, JavaScript's built-in "timezone" offset tends to just get in the way, so this library simply doesn't use it at all. All times are returned with zero offset, as though it didn't exist in JavaScript. -**The bottom line is the returned "UTC" dates are always meant to be interpreted as dates in your local timezone. This may mean you have to do additional conversion to get the "correct" local time with offset applied.** +**THE BOTTOM LINE: Returned "UTC" dates are always meant to be interpreted as dates in your local timezone. This may mean you have to do additional conversion to get the "correct" local time with offset applied.** -For this reason, it is highly recommended to use timestamps in UTC eg. `new Date(Date.UTC(...))`. Returned dates will likewise be in UTC (except on Chrome, which always returns dates with a timezone offset). It's recommended to use the provided `datetime` helper, which +For this reason, it is highly recommended to use timestamps in UTC eg. `new Date(Date.UTC(...))`. Returned dates will likewise be in UTC (except on Chrome, which always returns dates with a timezone offset). It's recommended to use the provided `datetime()` helper, which creates dates in the correct format using a 1-based month. For example: @@ -202,7 +202,7 @@ date.getUTCDate() // --> 1 date.getUTCHours() // --> 18 ``` -If you want to get the same times in true UTC, you may do so eg. using [Luxon](https://moment.github.io/luxon/#/): +If you want to get the same times in true UTC, you may do so (e.g., using [Luxon](https://moment.github.io/luxon/#/)): ```ts rule.all().map(date => @@ -282,7 +282,7 @@ iCalendar RFC. Only `freq` is required. Option Description - + freq @@ -491,7 +491,7 @@ rule.all(function (date, i) { ##### `RRule.prototype.between(after, before, inc=false [, iterator])` Returns all the occurrences of the rrule between `after` and `before`. -The inc keyword defines what happens if `after` and/or `before` are +The `inc` keyword defines what happens if `after` and/or `before` are themselves occurrences. With `inc == true`, they will be included in the list, if they are found in the recurrence set. @@ -582,8 +582,8 @@ var rule = new RRule(options) #### Natural Language Text Methods -These methods provide an incomplete support for text–`RRule` and -`RRule`–text conversion. You should test them with your input to see +These methods provide an incomplete support for text→`RRule` and +`RRule`→text conversion. You should test them with your input to see whether the result is acceptable. ##### `RRule.prototype.toText([gettext, [language]])` @@ -634,7 +634,7 @@ var rule = new RRule(options) new RRuleSet([(noCache = false)]) ``` -The RRuleSet instance allows more complex recurrence setups, mixing multiple +The `RRuleSet` instance allows more complex recurrence setups, mixing multiple rules, dates, exclusion rules, and exclusion dates. Default `noCache` argument is `false`, caching of results will be enabled, @@ -642,30 +642,30 @@ improving performance of multiple queries considerably. ##### `RRuleSet.prototype.rrule(rrule)` -Include the given rrule instance in the recurrence set generation. +Include the given `rrule` instance in the recurrence set generation. ##### `RRuleSet.prototype.rdate(dt)` -Include the given datetime instance in the recurrence set generation. +Include the given datetime instance `dt` in the recurrence set generation. ##### `RRuleSet.prototype.exrule(rrule)` -Include the given rrule instance in the recurrence set exclusion list. Dates +Include the given `rrule` instance in the recurrence set exclusion list. Dates which are part of the given recurrence rules will not be generated, even if -some inclusive rrule or rdate matches them. NOTE: EXRULE has been (deprecated +some inclusive rrule or rdate matches them. **NOTE:** `EXRULE` has been (deprecated in RFC 5545)[https://icalendar.org/iCalendar-RFC-5545/a-3-deprecated-features.html] -and does not support a DTSTART property. +and does not support a `DTSTART` property. ##### `RRuleSet.prototype.exdate(dt)` -Include the given datetime instance in the recurrence set exclusion list. Dates -included that way will not be generated, even if some inclusive rrule or -rdate matches them. +Include the given datetime instance `dt` in the recurrence set exclusion list. Dates +included that way will not be generated, even if some inclusive `rrule` or +`rdate` matches them. ##### `RRuleSet.prototype.tzid(tz?)` Sets or overrides the timezone identifier. Useful if there are no rrules in this -RRuleSet and thus no DTSTART. +`RRuleSet` and thus no `DTSTART`. ##### `RRuleSet.prototype.all([iterator])` @@ -709,36 +709,57 @@ rrulestr(rruleStr[, options]) The `rrulestr` function is a parser for RFC-like syntaxes. The string passed as parameter may be a multiple line string, a single line string, or just the -RRULE property value. +`RRULE` property value. Additionally, it accepts the following keyword arguments: -`cache` -If True, the rruleset or rrule created instance will cache its results. -Default is not to cache. - -`dtstart` -If given, it must be a datetime instance that will be used when no DTSTART -property is found in the parsed string. If it is not given, and the property -is not found, datetime.now() will be used instead. - -`unfold` -If set to True, lines will be unfolded following the RFC specification. It -defaults to False, meaning that spaces before every line will be stripped. - -`forceset` -If set to True a rruleset instance will be returned, even if only a single rule -is found. The default is to return an rrule if possible, and an rruleset if necessary. +
-`compatible` -If set to True, the parser will operate in RFC-compatible mode. Right now it -means that unfold will be turned on, and if a DTSTART is found, it will be -considered the first recurrence instance, as documented in the RFC. +
cache
+
+If true, the rruleset or rrule created instance +will cache its results. +Default is not to cache. +
+ +
dtstart
+
+If given, it must be a datetime instance that will be used when no +DTSTART property is found in the parsed string. +If it is not given, and the property is not found, +datetime.now() will be used instead. +
+ +
unfold
+
+If set to true, lines will be unfolded following the RFC specification. +It defaults to false, meaning that spaces before every line will be stripped. +
+ +
forceset
+
+If set to true, an rruleset instance will be returned, +even if only a single rule is found. +The default is to return an rrule if possible, and +an rruleset if necessary. +
+ +
compatible
+
+If set to true, the parser will operate in RFC-compatible mode. +Right now it means that unfold will be turned on, and if a DTSTART is found, +it will be considered the first recurrence instance, as documented in the RFC. +
+ +
tzid
+
+If given, it must be a string that will be used when no TZID +property is found in the parsed string. +If it is not given, and the property is not found, 'UTC' will +be used by default. +
-`tzid` -If given, it must be a string that will be used when no `TZID` property is found -in the parsed string. If it is not given, and the property is not found, `'UTC'` -will be used by default. +
--- @@ -771,8 +792,8 @@ rruleSet.rrule( rruleSet.rdate(start) ``` -- Unlike documented in the RFC, every keyword is valid on every frequency (the - RFC documents that `byweekno` is only valid on yearly frequencies, for example). +- Unlike documented in the RFC, every keyword is valid on every frequency. (The + RFC documents that `byweekno` is only valid on yearly frequencies, for example.) ### Development @@ -798,13 +819,13 @@ $ yarn build #### Authors -- [Jakub Roztocil](http://roztocil.co/) +- [Jakub Roztocil](http://roztocil.co) ([@jakubroztocil](http://twitter.com/jakubroztocil)) - Lars Schöning ([@lyschoening](http://twitter.com/lyschoening)) - David Golightly ([@davigoli](http://twitter.com/davigoli)) Python `dateutil` is written by [Gustavo -Niemeyer](http://niemeyer.net/). +Niemeyer](http://niemeyer.net). See [LICENCE](https://github.com/jakubroztocil/rrule/blob/master/LICENCE) for more details. @@ -822,4 +843,4 @@ more details. #### Related projects -- https://rrules.com/ — RESTful API to get back occurrences of RRULEs that conform to RFC 5545. +- https://rrules.com — RESTful API to get back occurrences of RRULEs that conform to RFC 5545. From bd90e721cb9c793c2adcd17a6bd59298a23d588e Mon Sep 17 00:00:00 2001 From: Derek Baum <1357242+db82407@users.noreply.github.com> Date: Mon, 8 Aug 2022 21:16:54 +0100 Subject: [PATCH 04/15] fix rezonedDate without luxon (commit: cf76af3) https://github.com/jakubroztocil/rrule/issues/523 --- src/datewithzone.ts | 4 ++-- test/rrule.test.ts | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/datewithzone.ts b/src/datewithzone.ts index 9bcd50cb..91cf19a9 100644 --- a/src/datewithzone.ts +++ b/src/datewithzone.ts @@ -36,10 +36,10 @@ export class DateWithZone { const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone const dateInLocalTZ = new Date( - this.date.toLocaleString(undefined, { timeZone: localTimeZone }) + this.date.toLocaleString('en-US', { timeZone: localTimeZone }) ) const dateInTargetTZ = new Date( - this.date.toLocaleString(undefined, { timeZone: this.tzid ?? 'UTC' }) + this.date.toLocaleString('en-US', { timeZone: this.tzid ?? 'UTC' }) ) const tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime() diff --git a/test/rrule.test.ts b/test/rrule.test.ts index d6e1d146..83959ff5 100644 --- a/test/rrule.test.ts +++ b/test/rrule.test.ts @@ -158,6 +158,27 @@ describe('RRule', function () { ] ) + testRecurring( + 'testBetweenWithTZ', + { + rrule: new RRule({ + freq: RRule.WEEKLY, + dtstart: parse('20220613T090000'), + byweekday: [RRule.TU], + tzid: 'Europe/London' + }), + method: 'between', + args: [parse('20220613T093000'), parse('20220716T083000')], + }, + [ + datetime(2022, 6, 14, 9, 0), + datetime(2022, 6, 21, 9, 0), + datetime(2022, 6, 28, 9, 0), + datetime(2022, 7, 5, 9, 0), + datetime(2022, 7, 12, 9, 0), + ] + ) + testRecurring( 'testYearly', new RRule({ From aedf23d3d426ca00088aada9f6aaf3e3cb147226 Mon Sep 17 00:00:00 2001 From: Jordan Epps Date: Fri, 25 Nov 2022 10:58:15 -0800 Subject: [PATCH 05/15] Fixes return types for the before and after query methods to match the documentation --- src/rrule.ts | 8 ++++---- src/types.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rrule.ts b/src/rrule.ts index 3d59de6e..cab2d1dd 100644 --- a/src/rrule.ts +++ b/src/rrule.ts @@ -204,7 +204,7 @@ export class RRule implements QueryMethods { * * @return Date or null */ - before(dt: Date, inc = false): Date { + before(dt: Date, inc = false): Date | null { if (!isValidDate(dt)) { throw new Error('Invalid date passed in to RRule.before') } @@ -214,7 +214,7 @@ export class RRule implements QueryMethods { result = this._iter(new IterResult('before', args)) this._cacheAdd('before', result, args) } - return result as Date + return result as Date | null } /** @@ -224,7 +224,7 @@ export class RRule implements QueryMethods { * * @return Date or null */ - after(dt: Date, inc = false): Date { + after(dt: Date, inc = false): Date | null { if (!isValidDate(dt)) { throw new Error('Invalid date passed in to RRule.after') } @@ -234,7 +234,7 @@ export class RRule implements QueryMethods { result = this._iter(new IterResult('after', args)) this._cacheAdd('after', result, args) } - return result as Date + return result as Date | null } /** diff --git a/src/types.ts b/src/types.ts index e540563c..81785142 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3,8 +3,8 @@ import { Weekday, WeekdayStr } from './weekday' export interface QueryMethods { all(): Date[] between(after: Date, before: Date, inc: boolean): Date[] - before(date: Date, inc: boolean): Date - after(date: Date, inc: boolean): Date + before(date: Date, inc: boolean): Date | null + after(date: Date, inc: boolean): Date | null } export type QueryMethodTypes = keyof QueryMethods From f11ae2d97943200ea1485ba5b64e17e8e9a63675 Mon Sep 17 00:00:00 2001 From: Derek Baum <1357242+db82407@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:23:12 +0000 Subject: [PATCH 06/15] convert Date.toLocaleString to ISO8601 before calling Date constructor --- src/datewithzone.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/datewithzone.ts b/src/datewithzone.ts index 91cf19a9..b554bc72 100644 --- a/src/datewithzone.ts +++ b/src/datewithzone.ts @@ -34,13 +34,17 @@ export class DateWithZone { return this.date } + const dateTZtoISO8601 = (date: Date, timeZone: string) => { + // date format for sv-SE is almost ISO8601 + const dateStr = date.toLocaleString('sv-SE', { timeZone }) + // '2023-02-07 10:41:36' + return dateStr.replace(' ', 'T') + 'Z' + } + const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone - const dateInLocalTZ = new Date( - this.date.toLocaleString('en-US', { timeZone: localTimeZone }) - ) - const dateInTargetTZ = new Date( - this.date.toLocaleString('en-US', { timeZone: this.tzid ?? 'UTC' }) - ) + // Date constructor can only reliably parse dates in ISO8601 format + const dateInLocalTZ = new Date(dateTZtoISO8601(this.date, localTimeZone)) + const dateInTargetTZ = new Date(dateTZtoISO8601(this.date, this.tzid ?? 'UTC')) const tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime() return new Date(this.date.getTime() - tzOffset) From 47310e6daf6cb2a4db2fec10048b618d226c9d1f Mon Sep 17 00:00:00 2001 From: Derek Baum <1357242+db82407@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:42:25 +0000 Subject: [PATCH 07/15] fix prettier errors --- src/datewithzone.ts | 4 +++- test/rrule.test.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/datewithzone.ts b/src/datewithzone.ts index b554bc72..1ba43213 100644 --- a/src/datewithzone.ts +++ b/src/datewithzone.ts @@ -44,7 +44,9 @@ export class DateWithZone { const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone // Date constructor can only reliably parse dates in ISO8601 format const dateInLocalTZ = new Date(dateTZtoISO8601(this.date, localTimeZone)) - const dateInTargetTZ = new Date(dateTZtoISO8601(this.date, this.tzid ?? 'UTC')) + const dateInTargetTZ = new Date( + dateTZtoISO8601(this.date, this.tzid ?? 'UTC') + ) const tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime() return new Date(this.date.getTime() - tzOffset) diff --git a/test/rrule.test.ts b/test/rrule.test.ts index 83959ff5..47ec34cf 100644 --- a/test/rrule.test.ts +++ b/test/rrule.test.ts @@ -165,7 +165,7 @@ describe('RRule', function () { freq: RRule.WEEKLY, dtstart: parse('20220613T090000'), byweekday: [RRule.TU], - tzid: 'Europe/London' + tzid: 'Europe/London', }), method: 'between', args: [parse('20220613T093000'), parse('20220716T083000')], From efead41f5c507e6b1a2f8cc6bdfc9ac21efe8884 Mon Sep 17 00:00:00 2001 From: Derek Baum <1357242+db82407@users.noreply.github.com> Date: Thu, 9 Feb 2023 23:55:15 +0000 Subject: [PATCH 08/15] fix expectedDates for testBetweenWithTZ to be in same TZ as test. extract dateInTimeZone() from rezonedDate() and add to dateutils.ts, so it can also be used by expectedDate(). --- src/dateutil.ts | 17 +++++++++++++++++ src/datewithzone.ts | 19 ++----------------- test/lib/utils.ts | 15 ++------------- test/rrule.test.ts | 10 +++++----- 4 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/dateutil.ts b/src/dateutil.ts index 59cbcc6d..66b43a61 100644 --- a/src/dateutil.ts +++ b/src/dateutil.ts @@ -201,3 +201,20 @@ export const untilStringToDate = function (until: string) { ) ) } + +const dateTZtoISO8601 = function (date: Date, timeZone: string) { + // date format for sv-SE is almost ISO8601 + const dateStr = date.toLocaleString('sv-SE', { timeZone }) + // '2023-02-07 10:41:36' + return dateStr.replace(' ', 'T') + 'Z' +} + +export const dateInTimeZone = function (date: Date, timeZone: string) { + const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone + // Date constructor can only reliably parse dates in ISO8601 format + const dateInLocalTZ = new Date(dateTZtoISO8601(date, localTimeZone)) + const dateInTargetTZ = new Date(dateTZtoISO8601(date, timeZone ?? 'UTC')) + const tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime() + + return new Date(date.getTime() - tzOffset) +} diff --git a/src/datewithzone.ts b/src/datewithzone.ts index 1ba43213..e05fcc2e 100644 --- a/src/datewithzone.ts +++ b/src/datewithzone.ts @@ -1,4 +1,4 @@ -import { timeToUntilString } from './dateutil' +import { dateInTimeZone, timeToUntilString } from './dateutil' export class DateWithZone { public date: Date @@ -34,21 +34,6 @@ export class DateWithZone { return this.date } - const dateTZtoISO8601 = (date: Date, timeZone: string) => { - // date format for sv-SE is almost ISO8601 - const dateStr = date.toLocaleString('sv-SE', { timeZone }) - // '2023-02-07 10:41:36' - return dateStr.replace(' ', 'T') + 'Z' - } - - const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone - // Date constructor can only reliably parse dates in ISO8601 format - const dateInLocalTZ = new Date(dateTZtoISO8601(this.date, localTimeZone)) - const dateInTargetTZ = new Date( - dateTZtoISO8601(this.date, this.tzid ?? 'UTC') - ) - const tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime() - - return new Date(this.date.getTime() - tzOffset) + return dateInTimeZone(this.date, this.tzid) } } diff --git a/test/lib/utils.ts b/test/lib/utils.ts index 5610b384..f37eb088 100644 --- a/test/lib/utils.ts +++ b/test/lib/utils.ts @@ -1,7 +1,7 @@ import { expect } from 'chai' import { ExclusiveTestFunction, TestFunction } from 'mocha' export { datetime } from '../../src/dateutil' -import { datetime } from '../../src/dateutil' +import { dateInTimeZone, datetime } from '../../src/dateutil' import { RRule, RRuleSet } from '../../src' const assertDatesEqual = function ( @@ -239,16 +239,5 @@ export function expectedDate( currentLocalDate: Date, targetZone: string ): Date { - // get the tzoffset between the client tz and the target tz - const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone - const dateInLocalTZ = new Date( - startDate.toLocaleString(undefined, { timeZone: localTimeZone }) - ) - const dateInTargetTZ = new Date( - startDate.toLocaleString(undefined, { timeZone: targetZone }) - ) - const tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime() - - return new Date(startDate.getTime() - tzOffset) - // return new Date(new Date(startDate.getTime() + tzOffset).toLocaleDateString(undefined, { timeZone: localTimeZone })) + return dateInTimeZone(startDate, targetZone) } diff --git a/test/rrule.test.ts b/test/rrule.test.ts index 47ec34cf..d5f70762 100644 --- a/test/rrule.test.ts +++ b/test/rrule.test.ts @@ -171,11 +171,11 @@ describe('RRule', function () { args: [parse('20220613T093000'), parse('20220716T083000')], }, [ - datetime(2022, 6, 14, 9, 0), - datetime(2022, 6, 21, 9, 0), - datetime(2022, 6, 28, 9, 0), - datetime(2022, 7, 5, 9, 0), - datetime(2022, 7, 12, 9, 0), + expectedDate(datetime(2022, 6, 14, 9, 0), undefined, 'Europe/London'), + expectedDate(datetime(2022, 6, 21, 9, 0), undefined, 'Europe/London'), + expectedDate(datetime(2022, 6, 28, 9, 0), undefined, 'Europe/London'), + expectedDate(datetime(2022, 7, 5, 9, 0), undefined, 'Europe/London'), + expectedDate(datetime(2022, 7, 12, 9, 0), undefined, 'Europe/London'), ] ) From 13ed66233cefbde32a6eba25545743e2a9d56b57 Mon Sep 17 00:00:00 2001 From: Derek Baum <1357242+db82407@users.noreply.github.com> Date: Fri, 10 Feb 2023 09:58:25 +0000 Subject: [PATCH 09/15] add LANG= to test matrix, using language for specified timezone. This fails for LANG=en_CA and LANG=sw_KE before rezonedDate() fix. --- .github/workflows/nodejs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index cd18eb3b..26893035 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -14,8 +14,8 @@ jobs: - run: npm install -g codecov nyc - run: yarn install - run: yarn build - - run: TZ=America/Vancouver yarn test - - run: TZ=America/Los_Angeles yarn test - - run: TZ=Africa/Nairobi yarn test - - run: TZ=Asia/Tokyo yarn test-ci + - run: LANG=en_CA TZ=America/Vancouver yarn test + - run: LANG=en_US TZ=America/Los_Angeles yarn test + - run: LANG=sw_KE TZ=Africa/Nairobi yarn test + - run: LANG=jp_JP TZ=Asia/Tokyo yarn test-ci - run: nyc report --reporter=json && codecov -t ${{ secrets.CODECOV_REPO_TOKEN }} -f coverage/*.json From fa76afd8e19d8ee29e6cd27a3b7fbb703714df55 Mon Sep 17 00:00:00 2001 From: David Golightly Date: Fri, 10 Feb 2023 10:51:44 -0800 Subject: [PATCH 10/15] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fed80fa4..9b4ac6b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### Changelog +- 2.7.2 (2023-02-10) + + - Fix rezonedDate (#523) + - 2.7.1 (2022-07-10) - Internal: From 2b73db6dbd9fbcd7d37ddb91f262fda3eb550e00 Mon Sep 17 00:00:00 2001 From: David Golightly Date: Fri, 10 Feb 2023 10:52:19 -0800 Subject: [PATCH 11/15] v2.7.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6a92e46c..e6d15dab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rrule", - "version": "2.7.1", + "version": "2.7.2", "description": "JavaScript library for working with recurrence rules for calendar dates.", "homepage": "http://jakubroztocil.github.io/rrule/", "license": "BSD-3-Clause", From 35d819ffdd4558335b1a66ffc1f2488149885da6 Mon Sep 17 00:00:00 2001 From: David Golightly Date: Fri, 10 Feb 2023 14:15:09 -0800 Subject: [PATCH 12/15] more changelog updates --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b4ac6b9..ebfafd9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ - 2.7.2 (2023-02-10) - - Fix rezonedDate (#523) + - Bugfixes: + - Fix rezonedDate ([#523](https://github.com/jakubroztocil/rrule/issues/523)) + - Export datetime ([#551](https://github.com/jakubroztocil/rrule/issues/551)) + - Fixes types for `before()` and `after()` ([#560](https://github.com/jakubroztocil/rrule/issues/560)) + - Update README (https://github.com/jakubroztocil/rrule/pull/543) - 2.7.1 (2022-07-10) From 023cb2f27f3d1de14fc400d14f3131c5e3247f7c Mon Sep 17 00:00:00 2001 From: Jeff Kwan Date: Mon, 10 Jul 2023 08:57:19 -0700 Subject: [PATCH 13/15] expose all weekdays constant from index file --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index b1452f1b..237a275f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,6 @@ export { RRuleSet } from './rruleset' export { rrulestr } from './rrulestr' export { Frequency, ByWeekday, Options } from './types' -export { Weekday, WeekdayStr } from './weekday' +export { Weekday, WeekdayStr, ALL_WEEKDAYS } from './weekday' export { RRuleStrOptions } from './rrulestr' export { datetime } from './dateutil' From dae185cd213a0b2a9575fbf4b6cbe3055b55c4b9 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sat, 26 Aug 2023 15:17:02 +0200 Subject: [PATCH 14/15] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c8e1c430..428dd9c9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![js-standard-style][js-standard-image]][js-standard-url] [![Downloads][downloads-image]][downloads-url] [![Gitter][gitter-image]][gitter-url] -[![codecov.io](http://codecov.io/github/jakubroztocil/rrule/coverage.svg?branch=master)](http://codecov.io/github/jakubroztocil/rrule?branch=master) +[![codecov.io](http://codecov.io/github/jkbrzt/rrule/coverage.svg?branch=master)](http://codecov.io/github/jkbrzt/rrule?branch=master) rrule.js supports recurrence rules as defined in the [iCalendar RFC](https://tools.ietf.org/html/rfc5545), with a few important @@ -21,7 +21,7 @@ to natural language. ### Quick Start -- [Demo app](http://jakubroztocil.github.io/rrule/) +- [Demo app](http://jkbrzt.github.io/rrule/) - # For contributors and maintainers: the code for the demo app is only on `gh-pages` branch #### Client Side @@ -32,8 +32,8 @@ $ yarn add rrule Alternatively, download manually: -- [rrule.min.js](https://jakubroztocil.github.io/rrule/dist/es5/rrule.min.js) (bundled, minified) -- [rrule.js](https://jakubroztocil.github.io/rrule/dist/es5/rrule.js) (bundled, not minified) +- [rrule.min.js](https://jkbrzt.github.io/rrule/dist/es5/rrule.min.js) (bundled, minified) +- [rrule.js](https://jkbrzt.github.io/rrule/dist/es5/rrule.js) (bundled, not minified) ```html @@ -820,20 +820,20 @@ $ yarn build #### Authors - [Jakub Roztocil](http://roztocil.co) - ([@jakubroztocil](http://twitter.com/jakubroztocil)) + ([@jkbrzt](http://twitter.com/jkbrzt)) - Lars Schöning ([@lyschoening](http://twitter.com/lyschoening)) - David Golightly ([@davigoli](http://twitter.com/davigoli)) Python `dateutil` is written by [Gustavo Niemeyer](http://niemeyer.net). -See [LICENCE](https://github.com/jakubroztocil/rrule/blob/master/LICENCE) for +See [LICENCE](https://github.com/jkbrzt/rrule/blob/master/LICENCE) for more details. [npm-url]: https://npmjs.org/package/rrule [npm-image]: http://img.shields.io/npm/v/rrule.svg -[ci-url]: https://github.com/jakubroztocil/rrule/actions -[ci-image]: https://github.com/jakubroztocil/rrule/workflows/Node%20CI/badge.svg +[ci-url]: https://github.com/jkbrzt/rrule/actions +[ci-image]: https://github.com/jkbrzt/rrule/workflows/Node%20CI/badge.svg [downloads-url]: https://npmjs.org/package/rrule [downloads-image]: http://img.shields.io/npm/dm/rrule.svg?style=flat-square [js-standard-url]: https://github.com/feross/standard From 62e7320a35195b2eef6bbec75887e8ec209b20ed Mon Sep 17 00:00:00 2001 From: Aviad Pineles Date: Fri, 10 Nov 2023 19:10:18 +0200 Subject: [PATCH 15/15] feat(nlp): support weekly by hour texts (#590) * feat(nlp): support weekly by hour texts e.g. 'every week on Sunday at 10, 12 and 17' would serialize to 'RRULE:FREQ=WEEKLY;BYDAY=SU;BYHOUR=10,12,17' * after prettier * forgot to add a case --- src/nlp/parsetext.ts | 3 +++ src/nlp/totext.ts | 4 ++++ test/nlp.test.ts | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/nlp/parsetext.ts b/src/nlp/parsetext.ts index e3495650..fbaeccf9 100644 --- a/src/nlp/parsetext.ts +++ b/src/nlp/parsetext.ts @@ -126,6 +126,7 @@ export default function parseText(text: string, language: Language = ENGLISH) { options.freq = RRule.WEEKLY options.byweekday = [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR] ttr.nextSymbol() + AT() F() break @@ -133,6 +134,7 @@ export default function parseText(text: string, language: Language = ENGLISH) { options.freq = RRule.WEEKLY if (ttr.nextSymbol()) { ON() + AT() F() } break @@ -198,6 +200,7 @@ export default function parseText(text: string, language: Language = ENGLISH) { options.byweekday.push(RRule[wkd] as ByWeekday) ttr.nextSymbol() } + AT() MDAYs() F() break diff --git a/src/nlp/totext.ts b/src/nlp/totext.ts index cbb614a1..0a2859cd 100644 --- a/src/nlp/totext.ts +++ b/src/nlp/totext.ts @@ -281,6 +281,10 @@ export default class ToText { } else if (this.byweekday) { this._byweekday() } + + if (this.origOptions.byhour) { + this._byhour() + } } } diff --git a/test/nlp.test.ts b/test/nlp.test.ts index c64e7b44..dc64c41c 100644 --- a/test/nlp.test.ts +++ b/test/nlp.test.ts @@ -7,6 +7,10 @@ import { datetime } from './lib/utils' const texts = [ ['Every day', 'RRULE:FREQ=DAILY'], ['Every day at 10, 12 and 17', 'RRULE:FREQ=DAILY;BYHOUR=10,12,17'], + [ + 'Every week on Sunday at 10, 12 and 17', + 'RRULE:FREQ=WEEKLY;BYDAY=SU;BYHOUR=10,12,17', + ], ['Every week', 'RRULE:FREQ=WEEKLY'], ['Every hour', 'RRULE:FREQ=HOURLY'], ['Every 4 hours', 'RRULE:INTERVAL=4;FREQ=HOURLY'],