Skip to content

Commit

Permalink
Ignore TZID in fully convertible logic. (#528)
Browse files Browse the repository at this point in the history
* TZID is fully convertible.

* Add test.

---------

Co-authored-by: Darren Zhao <[email protected]>
  • Loading branch information
DarryQueen and Darren Zhao authored Nov 10, 2023
1 parent 7e9e0c3 commit ab890aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/nlp/totext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default class ToText {
if (rrule.origOptions.until && rrule.origOptions.count) return false

for (const key in rrule.origOptions) {
if (contains(['dtstart', 'wkst', 'freq'], key)) return true
if (contains(['dtstart', 'tzid', 'wkst', 'freq'], key)) return true
if (!contains(ToText.IMPLEMENTED[rrule.options.freq], key)) return false
}

Expand Down
7 changes: 6 additions & 1 deletion test/nlp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const texts = [
['Every week for 20 times', 'RRULE:FREQ=WEEKLY;COUNT=20'],
]

const toTexts = [
...texts,
['Every week on monday', 'DTSTART;TZID=America/New_York:20220601T000000\nRRULE:INTERVAL=1;FREQ=WEEKLY;BYDAY=MO'],
]

describe('NLP', () => {
it('fromText()', function () {
texts.forEach(function (item) {
Expand All @@ -42,7 +47,7 @@ describe('NLP', () => {
})

it('toText()', function () {
texts.forEach(function (item) {
toTexts.forEach(function (item) {
const text = item[0]
const str = item[1]
expect(RRule.fromString(str).toText().toLowerCase()).toBe(
Expand Down

0 comments on commit ab890aa

Please sign in to comment.