File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -69,11 +69,21 @@ class ZonedDateTime {
6969  // Use this method instead of PlainDateTime.prototype.toZonedDateTime() and 
7070  // PlainDate.prototype.toZonedDateTime() 
7171  static  fromPlainDateTime ( pdt ,  timeZone ,  options )  { 
72-     if  ( timeZone . tzid )  { 
72+     if  ( Intl . supportedValuesOf ( ' timeZone' ) . includes ( timeZone . tzid ) )  { 
7373      const  temporalZDT  =  pdt . toZonedDateTime ( timeZone . tzid ,  options ) ; 
7474      return  new  ZonedDateTime ( temporalZDT . epochNanoseconds ,  timeZone ,  pdt . calendarId ) ; 
7575    } 
76-     const  icalTime  =  new  ICAL . Time ( pdt ,  timeZone ) ; 
76+     const  icalTime  =  new  ICAL . Time ( 
77+       { 
78+         year : pdt . year , 
79+         month : pdt . month , 
80+         day : pdt . day , 
81+         hour : pdt . hour , 
82+         minute : pdt . minute , 
83+         second : pdt . second 
84+       } , 
85+       timeZone 
86+     ) ; 
7787    const  epochSeconds  =  icalTime . toUnixTime ( ) ;  // apply disambiguation parameter? 
7888    const  epochNanoseconds  = 
7989      BigInt ( epochSeconds )  *  1000000000n  +  BigInt ( pdt . millisecond  *  1e6  +  pdt . microsecond  *  1e3  +  pdt . nanosecond ) ; 
@@ -273,7 +283,7 @@ class ZonedDateTime {
273283    if  ( this . #isIANA)  { 
274284      return  this . #impl. toString ( options ) ; 
275285    } 
276-     throw   new   Error ( 'not implemented' ) ; 
286+     return   this . toPlainDateTime ( ) . toString ( )   +   `[UNIMPLEMENTED: custom time zone  ${ this . #timeZone . tzid } ]` ; 
277287  } 
278288
279289  toJSON ( )  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments