@@ -51,7 +51,7 @@ export interface RRuleOptions {
5151  readonly  frequency : Frequency ; 
5252  readonly  interval ?: number ; 
5353  readonly  count ?: number ; 
54-   readonly  until ?: DateTime   |   DateTimeLike ; 
54+   readonly  until ?: DateTime ; 
5555  readonly  byWeekday ?: readonly  ( NWeekday  |  Weekday ) [ ] ; 
5656  readonly  byHour ?: readonly  number [ ] ; 
5757  readonly  byMinute ?: readonly  number [ ] ; 
@@ -147,7 +147,7 @@ export class RRule {
147147    return  new  this ( { 
148148      frequency : rrule . frequency , 
149149      interval : rrule . interval , 
150-       until : rrule . until , 
150+       until : rrule . until   &&   DateTime . fromPlain ( rrule . until ) , 
151151      count : rrule . count , 
152152      byWeekday : rrule . byWeekday , 
153153      byHour : rrule . byHour , 
@@ -188,67 +188,60 @@ export class RRule {
188188    return  rrule ; 
189189  } 
190190
191-   /** 
192-    * @internal  
193-    */ 
194-   public  static  fromPlainOrInstance ( rrule : RRule  |  RRuleLike ) : RRule  { 
195-     return  rrule  instanceof  RRule  ? rrule  : this . fromPlain ( rrule ) ; 
196-   } 
197- 
198191  public  setFrequency ( frequency : Frequency ) : RRule  { 
199-     return  new  RRule ( {  ...this . toPlain ( ) ,  frequency } ) ; 
192+     return  new  RRule ( {  ...this . toOptions ( ) ,  frequency } ) ; 
200193  } 
201194
202195  public  setInterval ( interval : number ) : RRule  { 
203-     return  new  RRule ( {  ...this . toPlain ( ) ,  interval } ) ; 
196+     return  new  RRule ( {  ...this . toOptions ( ) ,  interval } ) ; 
204197  } 
205198
206199  public  setCount ( count : number ) : RRule  { 
207-     return  new  RRule ( {  ...this . toPlain ( ) ,  count } ) ; 
200+     return  new  RRule ( {  ...this . toOptions ( ) ,  count } ) ; 
208201  } 
209202
210203  public  setByWeekday ( weekdays : readonly  ( NWeekday  |  Weekday ) [ ] ) : RRule  { 
211-     return  new  RRule ( {  ...this . toPlain ( ) ,  byWeekday : weekdays  } ) ; 
204+     return  new  RRule ( {  ...this . toOptions ( ) ,  byWeekday : weekdays  } ) ; 
212205  } 
213206
214207  public  setByHour ( hours : readonly  number [ ] ) : RRule  { 
215-     return  new  RRule ( {  ...this . toPlain ( ) ,  byHour : hours  } ) ; 
208+     return  new  RRule ( {  ...this . toOptions ( ) ,  byHour : hours  } ) ; 
216209  } 
217210
218211  public  setByMinute ( minutes : readonly  number [ ] ) : RRule  { 
219-     return  new  RRule ( {  ...this . toPlain ( ) ,  byMinute : minutes  } ) ; 
212+     return  new  RRule ( {  ...this . toOptions ( ) ,  byMinute : minutes  } ) ; 
220213  } 
221214
222215  public  setBySecond ( seconds : readonly  number [ ] ) : RRule  { 
223-     return  new  RRule ( {  ...this . toPlain ( ) ,  bySecond : seconds  } ) ; 
216+     return  new  RRule ( {  ...this . toOptions ( ) ,  bySecond : seconds  } ) ; 
224217  } 
225218
226219  public  setByMonthday ( days : readonly  number [ ] ) : RRule  { 
227-     return  new  RRule ( {  ...this . toPlain ( ) ,  byMonthday : days  } ) ; 
220+     return  new  RRule ( {  ...this . toOptions ( ) ,  byMonthday : days  } ) ; 
228221  } 
229222
230223  public  setBySetpos ( poses : readonly  number [ ] ) : RRule  { 
231-     return  new  RRule ( {  ...this . toPlain ( ) ,  bySetpos : poses  } ) ; 
224+     return  new  RRule ( {  ...this . toOptions ( ) ,  bySetpos : poses  } ) ; 
232225  } 
233226
234227  public  setByMonth ( months : readonly  Month [ ] ) : RRule  { 
235-     return  new  RRule ( {  ...this . toPlain ( ) ,  byMonth : months  } ) ; 
228+     return  new  RRule ( {  ...this . toOptions ( ) ,  byMonth : months  } ) ; 
236229  } 
237230
238231  public  setByWeekno ( weekNumbers : readonly  number [ ] ) : RRule  { 
239-     return  new  RRule ( {  ...this . toPlain ( ) ,  byWeekno : weekNumbers  } ) ; 
232+     return  new  RRule ( {  ...this . toOptions ( ) ,  byWeekno : weekNumbers  } ) ; 
240233  } 
241234
242235  public  setByYearday ( days : readonly  number [ ] ) : RRule  { 
243-     return  new  RRule ( {  ...this . toPlain ( ) ,  byYearday : days  } ) ; 
236+     return  new  RRule ( {  ...this . toOptions ( ) ,  byYearday : days  } ) ; 
244237  } 
245238
246239  public  setWeekstart ( day : Weekday ) : RRule  { 
247-     return  new  RRule ( {  ...this . toPlain ( ) ,  weekstart : day  } ) ; 
240+     return  new  RRule ( {  ...this . toOptions ( ) ,  weekstart : day  } ) ; 
248241  } 
249242
250-   public  setUntil ( datetime : DateTime   |   DateTimeLike ) : RRule  { 
251-     return  new  RRule ( {  ...this . toPlain ( ) ,  until : datetime  } ) ; 
243+   public  setUntil ( datetime : DateTime ) : RRule  { 
244+     return  new  RRule ( {  ...this . toOptions ( ) ,  until : datetime  } ) ; 
252245  } 
253246
254247  public  toString ( ) : string  { 
@@ -297,4 +290,23 @@ export class RRule {
297290      until : this . until ?. toPlain ( ) , 
298291    } ; 
299292  } 
293+ 
294+   private  toOptions ( ) : RRuleOptions  { 
295+     return  { 
296+       frequency : this . frequency , 
297+       interval : this . interval , 
298+       count : this . count , 
299+       byWeekday : this . byWeekday , 
300+       byHour : this . byHour , 
301+       byMinute : this . byMinute , 
302+       bySecond : this . bySecond , 
303+       byMonthday : this . byMonthday , 
304+       bySetpos : this . bySetpos , 
305+       byMonth : this . byMonth , 
306+       byWeekno : this . byWeekno , 
307+       byYearday : this . byYearday , 
308+       weekstart : this . weekstart , 
309+       until : this . until , 
310+     } ; 
311+   } 
300312} 
0 commit comments