Skip to content

Commit 4b95f00

Browse files
authored
Merge branch 'master' into master
2 parents 6ac9a3d + 4ef9268 commit 4b95f00

19 files changed

+2273
-1590
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [jakubroztocil, davidgoli]

.github/workflows/nodejs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Node CI
2-
on: [push]
2+
on: [push, pull_request]
33
jobs:
44
build:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
node-version: [6.x, 8.x, 10.x, 12.x]
8+
node-version: [10.x, 12.x]
99
steps:
1010
- uses: actions/checkout@v1
1111
- uses: actions/setup-node@v1

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
### Changelog
22

3+
- 2.6.5 (2020-08-23)
4+
- Bugfixes:
5+
- `luxon`-less binary should not contain any `luxon` imports (#410)
6+
- Fixed `toText` pluralization of “minutes“ (#415)
7+
- 2.6.4 (2019-12-18)
8+
- Bugfixes:
9+
- Calculating series with unknown timezones will produce infinite loop (#320)
10+
- Internal:
11+
- Upgrade build dependencies
12+
- 2.6.3 (2019-11-24)
13+
- Features
14+
- Allow passing `WeekdayStr` to `byweekday` like the types suggest is possible (#371)
15+
- 2.6.2 (2019-06-08)
16+
- Features
17+
- Allow two digits for `BYDAY` (#330)
18+
- Add a quick way to format `until` in `toText` (#313)
19+
- Add support for parsing an rrule string without frequency (#339)
20+
- Add getters for `rrules`, `exrules`, `rdates`, `exdates` (#347)
321
- 2.6.0 (2019-01-03)
422
- Bugfixes:
523
- Fix sourcemap structure (#303)

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ rruleSet.rdate(new Date(Date.UTC(2012, 6, 1, 10, 30)))
113113
rruleSet.rdate(new Date(Date.UTC(2012, 6, 2, 10, 30)))
114114

115115
// Add a exclusion rrule to rruleSet
116-
rruleSet.exrule(new r.RRule({
116+
rruleSet.exrule(new RRule({
117117
freq: RRule.MONTHLY,
118118
count: 2,
119119
dtstart: new Date(Date.UTC(2012, 2, 1, 10, 30))
@@ -246,7 +246,7 @@ new RRule({
246246
until: new Date(2018, 2, 31)
247247
}).all()
248248

249-
[ '2018-02-01T18:30:00.000Z' ]
249+
[ '2018-02-01T18:30:00.000Z', '2018-03-01T18:30:00.000Z' ]
250250

251251
// RIGHT: Will produce dates with recurrences at the correct time
252252
new RRule({
@@ -255,7 +255,7 @@ new RRule({
255255
until: new Date(Date.UTC(2018, 2, 31))
256256
}).all()
257257

258-
[ '2018-02-01T10:30:00.000Z' ]
258+
[ '2018-02-01T10:30:00.000Z', '2018-03-01T10:30:00.000Z' ]
259259
```
260260

261261
### API

demo/demo.ts

+127-55
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ const getOptionsCode = function (options: Partial<Options>) {
5555
v = `RRule.${RRule.FREQUENCIES[v as number]}`
5656
} else if (k === 'dtstart' || k === 'until') {
5757
const d = v as Date
58-
v = 'new Date(Date.UTC(' + [
59-
d.getUTCFullYear(),
60-
d.getUTCMonth(),
61-
d.getUTCDate(),
62-
d.getUTCHours(),
63-
d.getUTCMinutes(),
64-
d.getUTCSeconds()
65-
].join(', ') + '))'
58+
v =
59+
'new Date(Date.UTC(' +
60+
[
61+
d.getUTCFullYear(),
62+
d.getUTCMonth(),
63+
d.getUTCDate(),
64+
d.getUTCHours(),
65+
d.getUTCMinutes(),
66+
d.getUTCSeconds()
67+
].join(', ') +
68+
'))'
6669
} else if (k === 'byweekday') {
6770
if (Array.isArray(v)) {
6871
v = (v as Weekday[]).map(function (wday) {
@@ -111,13 +114,13 @@ const makeRows = function (dates: Date[]) {
111114
states[i] = prevStates[i]
112115
}
113116
const cls = states[i] ? 'a' : 'b'
114-
return `<td class='${ cls }'>${ part }</td>`
117+
return `<td class='${cls}'>${part}</td>`
115118
})
116119

117120
prevParts = parts
118121
prevStates = states
119122

120-
return `<tr><td>${ index + 1 }</td>${ cells.join('\n') }</tr>`
123+
return `<tr><td>${index + 1}</td>${cells.join('\n')}</tr>`
121124
})
122125

123126
return rows.join('\n\n')
@@ -131,21 +134,39 @@ $(function () {
131134
$tabs.find('a').removeClass('active')
132135
$a.addClass('active')
133136
$('#input-types section').hide()
134-
return $(`#input-types #${id}`).show().find('input:first').trigger('focus').trigger('change')
137+
return $(`#input-types #${id}`)
138+
.show()
139+
.find('input:first')
140+
.trigger('focus')
141+
.trigger('change')
135142
}
136143

137-
$('#input-types section').hide().each(function () {
138-
$('<a />', {
139-
href: `#${$(this).attr('id')}`
140-
}).text($(this).find('h3').hide().text()).appendTo($tabs).on('click', function () {
141-
activateTab($(this))
142-
return false
144+
$('#input-types section')
145+
.hide()
146+
.each(function () {
147+
$('<a />', {
148+
href: `#${$(this).attr('id')}`
149+
})
150+
.text(
151+
$(this)
152+
.find('h3')
153+
.hide()
154+
.text()
155+
)
156+
.appendTo($tabs)
157+
.on('click', function () {
158+
activateTab($(this))
159+
return false
160+
})
143161
})
144-
})
145162

146163
$('.examples code').on('click', function () {
147164
const $code = $(this)
148-
return $code.parents('section:first').find('input').val($code.text()).trigger('change')
165+
return $code
166+
.parents('section:first')
167+
.find('input')
168+
.val($code.text())
169+
.trigger('change')
149170
})
150171

151172
let init: string
@@ -169,44 +190,83 @@ $(function () {
169190
let values = getFormValues($in.parents('form'))
170191
let options: Partial<Options> = {}
171192

172-
for (let k in values) {
193+
for (const k in values) {
173194
const key = k as keyof Options
174195

175-
let value: string | string[] | Date | Weekday | Weekday[] | number | number[] = values[key]!
196+
let value = values[key]
176197
if (!value) {
177198
continue
178-
} else if (key === 'dtstart' || key === 'until') {
179-
const date = new Date(Date.parse(value + 'Z'))
180-
options[key] = date
181-
} else if (key === 'byweekday') {
182-
if (Array.isArray(value)) {
183-
options[key] = value.map(i => getDay(parseInt(i, 10)))
184-
} else {
185-
options[key] = getDay(parseInt(value, 10))
186-
}
187-
} else if (/^by/.test(key)) {
188-
if (!Array.isArray(value)) {
189-
value = value.split(/[,\s]+/)
190-
}
191-
value = value.filter(v => v)
192-
options[key] = value.map(n => parseInt(n, 10))
193-
} else if (key === 'tzid') {
194-
options[key] = value as string
195-
} else {
196-
options[key] = parseInt(value as string, 10)
197199
}
198200

199-
if (key === 'wkst') {
200-
options[key] = getDay(parseInt(value as string, 10))
201-
}
201+
switch (key) {
202+
case 'dtstart':
203+
case 'until':
204+
const date = new Date(Date.parse(value + 'Z'))
205+
options[key] = date
206+
continue
207+
208+
case 'byweekday':
209+
if (Array.isArray(value)) {
210+
options[key] = value.map(i => getDay(parseInt(i, 10)))
211+
} else {
212+
options[key] = getDay(parseInt(value, 10))
213+
}
214+
continue
215+
216+
case 'wkst':
217+
options[key] = getDay(parseInt(value as string, 10))
218+
continue
219+
220+
case 'interval':
221+
const i = parseInt(value as string, 10)
222+
if (i === 1 || !value) {
223+
continue
224+
}
225+
226+
options[key] = i
227+
continue
228+
229+
case 'tzid':
230+
options[key] = value as string
231+
continue
232+
233+
case 'byweekday':
234+
case 'byweekno':
235+
case 'byhour':
236+
case 'byminute':
237+
case 'bysecond':
238+
case 'byyearday':
239+
case 'bymonth':
240+
case 'bymonthday':
241+
case 'bysetpos':
242+
case 'bynmonthday':
243+
if (!Array.isArray(value)) {
244+
value = value.split(/[,\s]+/)
245+
}
246+
value = value.filter(v => v)
247+
options[key] = value.map(n => parseInt(n, 10))
248+
continue
202249

203-
if (key === 'interval') {
204-
const i = parseInt(value as string, 10)
205-
if (i === 1 || !value) {
250+
case 'bynweekday':
251+
if (!Array.isArray(value)) {
252+
value = value.split(/[,\s]+/)
253+
}
254+
value = value.filter(v => v)
255+
options[key] = [value.map(n => parseInt(n, 10))]
206256
continue
207-
}
208257

209-
options[key] = i
258+
case 'byeaster':
259+
options[key] = parseInt(value as string, 10)
260+
continue
261+
262+
case 'freq':
263+
case 'count':
264+
options[key] = parseInt(value as string, 10)
265+
continue
266+
267+
default:
268+
console.warn('Unsupported key', key)
269+
continue
210270
}
211271
}
212272

@@ -226,23 +286,33 @@ $(function () {
226286
try {
227287
rule = makeRule()
228288
} catch (e) {
229-
$('#init').append($('<pre class="error"/>').text(`=> ${String(e || null)}`))
289+
$('#init').append(
290+
$('<pre class="error"/>').text(`=> ${String(e || null)}`)
291+
)
230292
return
231293
}
232294

233295
const rfc = rule.toString()
234296
const text = rule.toText()
235-
$('#rfc-output a').text(rfc).attr('href', `#/rfc/${rfc}`)
236-
$('#text-output a').text(text).attr('href', `#/text/${text}`)
297+
$('#rfc-output a')
298+
.text(rfc)
299+
.attr('href', `#/rfc/${rfc}`)
300+
$('#text-output a')
301+
.text(text)
302+
.attr('href', `#/text/${text}`)
237303
$('#options-output').text(getOptionsCode(rule.origOptions))
238304
if (inputMethod === 'options') {
239-
$('#options-output').parents('tr').hide()
305+
$('#options-output')
306+
.parents('tr')
307+
.hide()
240308
} else {
241-
$('#options-output').parents('tr').show()
309+
$('#options-output')
310+
.parents('tr')
311+
.show()
242312
}
243313
const max = 500
244314
const dates = rule.all(function (date, i) {
245-
if (!rule.options.count && (i === max)) {
315+
if (!rule.options.count && i === max) {
246316
return false // That's enough
247317
}
248318
return true
@@ -268,7 +338,9 @@ $(function () {
268338
const method = match[1] // rfc | text
269339
const arg = match[2]
270340
activateTab($(`a[href='#${method}-input']`))
271-
return $(`#${method}-input input:first`).val(arg).trigger('change')
341+
return $(`#${method}-input input:first`)
342+
.val(arg)
343+
.trigger('change')
272344
}
273345
}
274346
}

package.json

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "rrule",
3-
"version": "2.6.2",
3+
"version": "2.6.5",
44
"description": "JavaScript library for working with recurrence rules for calendar dates.",
55
"homepage": "http://jakubroztocil.github.io/rrule/",
6-
"license": "SEE LICENSE IN LICENSE",
6+
"license": "BSD-3-Clause",
77
"keywords": [
88
"dates",
99
"recurrences",
@@ -44,31 +44,32 @@
4444
"all": true
4545
},
4646
"devDependencies": {
47-
"@types/assert": "^0.0.31",
48-
"@types/chai": "^4.1.4",
47+
"@types/assert": "^1.4.3",
48+
"@types/chai": "^4.2.7",
4949
"@types/jquery": "^3.3.29",
50-
"@types/luxon": "^1.2.2",
50+
"@types/luxon": "^1.21.0",
5151
"@types/mocha": "^5.2.5",
5252
"@types/mockdate": "^2.0.0",
53-
"@types/node": "^10.12.18",
54-
"chai": "^4.1.2",
55-
"copy-webpack-plugin": "^4.5.2",
56-
"coverage": "^0.0.0",
53+
"@types/node": "^12.12.18",
54+
"chai": "^4.2.0",
55+
"copy-webpack-plugin": "^5.1.1",
56+
"coverage": "^0.4.1",
5757
"html-webpack-plugin": "^3.2.0",
58-
"husky": "^1.0.0-rc.13",
58+
"husky": "^3.1.0",
5959
"jquery": "^3.3.1",
60-
"mocha": "^5.2.0",
61-
"mockdate": "^2.0.2",
62-
"nyc": "^12.0.2",
60+
"mocha": "^6.2.2",
61+
"mockdate": "^2.0.5",
62+
"nyc": "^14.1.1",
6363
"source-map-loader": "^0.2.4",
64-
"source-map-support": "^0.5.8",
65-
"ts-loader": "^4.4.2",
66-
"ts-node": "^7.0.0",
67-
"tslint": "^5.11.0",
64+
"source-map-support": "^0.5.16",
65+
"ts-loader": "^6.2.1",
66+
"ts-node": "^8.5.4",
67+
"tslint": "^5.20.1",
6868
"tslint-eslint-rules": "^5.4.0",
69-
"typescript": "^3.0.1",
70-
"webpack": "^4.16.3",
71-
"webpack-cli": "^3.1.0"
69+
"typescript": "^3.7.3",
70+
"uglifyjs-webpack-plugin": "^2.2.0",
71+
"webpack": "^4.41.3",
72+
"webpack-cli": "^3.3.10"
7273
},
7374
"standard": {
7475
"ignore": [
@@ -80,10 +81,10 @@
8081
"README.md"
8182
],
8283
"optionalDependencies": {
83-
"luxon": "^1.3.3"
84+
"luxon": "^1.21.3"
8485
},
8586
"peerDependencies": {},
8687
"dependencies": {
87-
"tslib": "^1.9.0"
88+
"tslib": "^1.10.0"
8889
}
8990
}

0 commit comments

Comments
 (0)