@@ -474,15 +474,21 @@ export const unsafeMake = <A extends DateTime.Input>(input: A): DateTime.Preserv
474474 *
475475 * DateTime.unsafeMakeZoned(new Date(), { timeZone: "Europe/London" })
476476 */
477- export const unsafeMakeZoned = ( input : DateTime . Input , options : {
478- readonly timeZone : number | string | TimeZone
477+ export const unsafeMakeZoned = ( input : DateTime . Input , options ? : {
478+ readonly timeZone ? : number | string | TimeZone | undefined
479479 readonly adjustForTimeZone ?: boolean | undefined
480480} ) : Zoned => {
481+ if ( options ?. timeZone === undefined && isDateTime ( input ) && isZoned ( input ) ) {
482+ return input
483+ }
481484 const self = unsafeMake ( input )
482485 let zone : TimeZone
483- if ( isTimeZone ( options . timeZone ) ) {
486+ if ( options ?. timeZone === undefined ) {
487+ const offset = new Date ( self . epochMillis ) . getTimezoneOffset ( ) * - 60 * 1000
488+ zone = zoneMakeOffset ( offset )
489+ } else if ( isTimeZone ( options ?. timeZone ) ) {
484490 zone = options . timeZone
485- } else if ( typeof options . timeZone === "number" ) {
491+ } else if ( typeof options ? .timeZone === "number" ) {
486492 zone = zoneMakeOffset ( options . timeZone )
487493 } else {
488494 const parsedZone = zoneFromString ( options . timeZone )
@@ -491,7 +497,7 @@ export const unsafeMakeZoned = (input: DateTime.Input, options: {
491497 }
492498 zone = parsedZone . value
493499 }
494- if ( options . adjustForTimeZone !== true ) {
500+ if ( options ? .adjustForTimeZone !== true ) {
495501 return makeZonedProto ( self . epochMillis , zone , self . partsUtc )
496502 }
497503 return makeZonedFromAdjusted ( self . epochMillis , zone )
@@ -513,12 +519,11 @@ export const unsafeMakeZoned = (input: DateTime.Input, options: {
513519 */
514520export const makeZoned : (
515521 input : DateTime . Input ,
516- options : {
517- readonly timeZone : number | string | TimeZone
522+ options ? : {
523+ readonly timeZone ? : number | string | TimeZone | undefined
518524 readonly adjustForTimeZone ?: boolean | undefined
519525 }
520- ) => Option . Option < Zoned > = Option
521- . liftThrowable ( unsafeMakeZoned )
526+ ) => Option . Option < Zoned > = Option . liftThrowable ( unsafeMakeZoned )
522527
523528/**
524529 * Create a `DateTime` from one of the following:
0 commit comments