Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode rrule text from url #477

Open
wants to merge 7 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
### Changelog

- 2.6.8 (2021-02-04)
- Bugfixes:
- Solve circular imports (#444)

- 2.6.6 (2020-08-23)
- Bugfixes:
- Fixed broken npm package (#417)

- 2.6.5 (2020-08-23)
- Bugfixes:
- `luxon`-less binary should not contain any `luxon` imports (#410)
Expand Down
2 changes: 1 addition & 1 deletion demo/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ $(function () {
const arg = match[2]
activateTab($(`a[href='#${method}-input']`))
return $(`#${method}-input input:first`)
.val(arg)
.val(decodeURIComponent(arg))
.trigger('change')
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rrule",
"version": "2.6.5",
"version": "2.6.8",
"description": "JavaScript library for working with recurrence rules for calendar dates.",
"homepage": "http://jakubroztocil.github.io/rrule/",
"license": "BSD-3-Clause",
Expand Down
6 changes: 3 additions & 3 deletions src/fake-luxon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const DateTime = {
fromJSDate() {
throw new TypeError();
fromJSDate () {
throw new TypeError()
}
};
}
13 changes: 7 additions & 6 deletions src/nlp/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ToText, { DateFormatter, GetText } from './totext'
import parseText from './parsetext'
import RRule from '../index'
import { Frequency } from '../types'
import ENGLISH, { Language } from './i18n'

/*!
Expand Down Expand Up @@ -108,12 +109,12 @@ const common = [
]

ToText.IMPLEMENTED = []
ToText.IMPLEMENTED[RRule.HOURLY] = common
ToText.IMPLEMENTED[RRule.MINUTELY] = common
ToText.IMPLEMENTED[RRule.DAILY] = ['byhour'].concat(common)
ToText.IMPLEMENTED[RRule.WEEKLY] = common
ToText.IMPLEMENTED[RRule.MONTHLY] = common
ToText.IMPLEMENTED[RRule.YEARLY] = ['byweekno', 'byyearday'].concat(common)
ToText.IMPLEMENTED[Frequency.HOURLY] = common
ToText.IMPLEMENTED[Frequency.MINUTELY] = common
ToText.IMPLEMENTED[Frequency.DAILY] = ['byhour'].concat(common)
ToText.IMPLEMENTED[Frequency.WEEKLY] = common
ToText.IMPLEMENTED[Frequency.MONTHLY] = common
ToText.IMPLEMENTED[Frequency.YEARLY] = ['byweekno', 'byyearday'].concat(common)

// =============================================================================
// Export
Expand Down
23 changes: 5 additions & 18 deletions src/rrule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import dateutil from './dateutil'
import IterResult, { IterArgs } from './iterresult'
import CallbackIterResult from './callbackiterresult'
import { Language } from './nlp/i18n'
import { Nlp } from './nlp/index'
import { fromText, parseText, toText, isFullyConvertible } from './nlp/index'
import { DateFormatter, GetText } from './nlp/totext'
import { ParsedOptions, Options, Frequency, QueryMethods, QueryMethodTypes, IterResultType } from './types'
import { parseOptions, initializeOptions } from './parseoptions'
Expand All @@ -13,19 +13,6 @@ import { Cache, CacheKeys } from './cache'
import { Weekday } from './weekday'
import { iter } from './iter/index'

interface GetNlp {
_nlp: Nlp
(): Nlp
}

const getnlp: GetNlp = function () {
// Lazy, runtime import to avoid circular refs.
if (!getnlp._nlp) {
getnlp._nlp = require('./nlp')
}
return getnlp._nlp
} as GetNlp

// =============================================================================
// RRule
// =============================================================================
Expand Down Expand Up @@ -114,11 +101,11 @@ export default class RRule implements QueryMethods {
}

static parseText (text: string, language?: Language) {
return getnlp().parseText(text, language)
return parseText(text, language)
}

static fromText (text: string, language?: Language) {
return getnlp().fromText(text, language)
return fromText(text, language)
}

static parseString = parseString
Expand Down Expand Up @@ -256,11 +243,11 @@ export default class RRule implements QueryMethods {
* to text.
*/
toText (gettext?: GetText, language?: Language, dateFormatter?: DateFormatter) {
return getnlp().toText(this, gettext, language, dateFormatter)
return toText(this, gettext, language, dateFormatter)
}

isFullyConvertibleToText () {
return getnlp().isFullyConvertible(this)
return isFullyConvertible(this)
}

/**
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": "./dist/esm",
"outDir": "./dist/esm",
"declaration": true,
"declarationMap": true,
Expand Down