Пример #1
0
            internal static ZonedDateTime NewZonedDateTime(long epochSecondLocal, long nano, ZoneId zoneId)
            {
                Instant  instant       = Instant.ofEpochSecond(epochSecondLocal, nano);
                DateTime localDateTime = DateTime.ofInstant(instant, UTC);

                return(ZonedDateTime.of(localDateTime, zoneId));
            }
Пример #2
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            BondFutureOption test = sut();

            assertEquals(test.PutCall, CALL);
            assertEquals(test.StrikePrice, STRIKE_PRICE);
            assertEquals(test.ExpiryDate, EXPIRY_DATE);
            assertEquals(test.ExpiryTime, EXPIRY_TIME);
            assertEquals(test.ExpiryZone, EXPIRY_ZONE);
            assertEquals(test.Expiry, ZonedDateTime.of(EXPIRY_DATE, EXPIRY_TIME, EXPIRY_ZONE));
            assertEquals(test.Rounding, Rounding.none());
            assertEquals(test.UnderlyingFuture, FUTURE);
            assertEquals(test.Currency, FUTURE.Currency);
        }
Пример #3
0
 protected internal override DateTimeValue selectDateTime(AnyValue datetime)
 {
     if (datetime is DateTimeValue)
     {
         DateTimeValue value = ( DateTimeValue )datetime;
         ZoneId        zone  = optionalTimezone();
         return(zone == null ? value : new DateTimeValue(ZonedDateTime.of(value.Temporal().toLocalDateTime(), zone)));
     }
     if (datetime is LocalDateTimeValue)
     {
         return(new DateTimeValue(ZonedDateTime.of((( LocalDateTimeValue )datetime).Temporal(), timezone())));
     }
     throw new UnsupportedTemporalUnitException("Cannot select datetime from: " + datetime);
 }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            FxVanillaOption test = sut();

            assertEquals(test.ExpiryDate, EXPIRY_DATE);
            assertEquals(test.Expiry, ZonedDateTime.of(EXPIRY_DATE, EXPIRY_TIME, EXPIRY_ZONE));
            assertEquals(test.ExpiryZone, EXPIRY_ZONE);
            assertEquals(test.ExpiryTime, EXPIRY_TIME);
            assertEquals(test.LongShort, LONG);
            assertEquals(test.Underlying, FX);
            assertEquals(test.CurrencyPair, FX.CurrencyPair);
            assertEquals(test.CrossCurrency, true);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(EUR, USD));
            assertEquals(test.allCurrencies(), ImmutableSet.of(EUR, USD));
        }
Пример #5
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            IborFutureOption test = sut();

            assertEquals(test.PutCall, CALL);
            assertEquals(test.StrikePrice, STRIKE_PRICE);
            assertEquals(test.ExpiryDate, EXPIRY_DATE);
            assertEquals(test.ExpiryTime, EXPIRY_TIME);
            assertEquals(test.ExpiryZone, EXPIRY_ZONE);
            assertEquals(test.Expiry, ZonedDateTime.of(EXPIRY_DATE, EXPIRY_TIME, EXPIRY_ZONE));
            assertEquals(test.Rounding, Rounding.none());
            assertEquals(test.UnderlyingFuture, FUTURE);
            assertEquals(test.Currency, FUTURE.Currency);
            assertEquals(test.Index, FUTURE.Index);
            assertEquals(test.CrossCurrency, false);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(USD));
            assertEquals(test.allCurrencies(), ImmutableSet.of(USD));
        }
Пример #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleTemporalUsingGraphResultDataContent() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleTemporalUsingGraphResultDataContent()
        {
            //Given
            GraphDatabaseFacade db   = Server().Database.Graph;
            ZonedDateTime       date = ZonedDateTime.of(1980, 3, 11, 0, 0, 0, 0, ZoneId.of("Europe/Stockholm"));

            using (Transaction tx = Db.beginTx())
            {
                Node node = Db.createNode(label("N"));
                node.SetProperty("date", date);
                tx.Success();
            }

            //When
            HTTP.Response response = RunQuery("MATCH (n:N) RETURN n", "graph");

            //Then
            assertEquals(200, response.Status());
            AssertNoErrors(response);
            JsonNode row = response.Get("results").get(0).get("data").get(0).get("graph").get("nodes").get(0).get("properties").get("date");

            assertEquals("\"1980-03-11T00:00+01:00[Europe/Stockholm]\"", row.ToString());
        }
Пример #7
0
        // ======================================================
        // Below is code for generating import data
        // ======================================================

        private IList <InputEntity> RandomNodeData()
        {
            IList <InputEntity> nodes = new List <InputEntity>();

            for (int i = 0; i < 300; i++)
            {
                InputEntity node = new InputEntity();
                node.Id(System.Guid.randomUUID().ToString(), [email protected]_Fields.Global);
                node.property("name", "Node " + i);
                node.property("pointA", "\"   { x : -4.2, y : " + i + ", crs: WGS-84 } \"");
                node.property("pointB", "\" { x : -8, y : " + i + " } \"");
                node.property("date", LocalDate.of(2018, i % 12 + 1, i % 28 + 1));
                node.property("time", OffsetTime.of(1, i % 60, 0, 0, ZoneOffset.ofHours(9)));
                node.property("dateTime", ZonedDateTime.of(2011, 9, 11, 8, i % 60, 0, 0, ZoneId.of("Europe/Stockholm")));
                node.property("dateTime2", new DateTime(2011, 9, 11, 8, i % 60, 0, 0));                             // No zone specified
                node.property("localTime", LocalTime.of(1, i % 60, 0));
                node.property("localDateTime", new DateTime(2011, 9, 11, 8, i % 60));
                node.property("duration", Period.of(2, -3, i % 30));
                node.Labels(RandomLabels(Random.random()));
                nodes.Add(node);
            }
            return(nodes);
        }
Пример #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _values = new List <Value>();
            // ZONED_DATE_TIME_ARRAY
            _values.Add(Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(2018, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(2017, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }));
            // LOCAL_DATE_TIME_ARRAY
            _values.Add(Values.localDateTimeArray(new DateTime[]
            {
                new DateTime(2018, 10, 9, 8, 7, 6, 5),
                new DateTime(2018, 10, 9, 8, 7, 6, 5)
            }));
            // DATE_ARRAY
            _values.Add(Values.dateArray(new LocalDate[] { LocalDate.of(1, 12, 28), LocalDate.of(1, 12, 28) }));
            // ZONED_TIME_ARRAY
            _values.Add(Values.timeArray(new OffsetTime[] { OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC) }));
            // LOCAL_TIME_ARRAY
            _values.Add(Values.localTimeArray(new LocalTime[] { LocalTime.of(19, 28), LocalTime.of(19, 28) }));
            // DURATION_ARRAY
            _values.Add(Values.durationArray(new DurationValue[] { DurationValue.duration(99, 10, 10, 10), DurationValue.duration(99, 10, 10, 10) }));
            // TEXT_ARRAY
            _values.Add(Values.of(new string[] { "someString1", "someString2" }));
            // BOOLEAN_ARRAY
            _values.Add(Values.of(new bool[] { true, true }));
            // NUMBER_ARRAY (byte, short, int, long, float, double)
            _values.Add(Values.of(new sbyte[] { ( sbyte )1, ( sbyte )12 }));
            _values.Add(Values.of(new short[] { 314, 1337 }));
            _values.Add(Values.of(new int[] { 3140, 13370 }));
            _values.Add(Values.of(new long[] { 31400, 133700 }));
            _values.Add(Values.of(new float[] { 0.5654f, 13432.14f }));
            _values.Add(Values.of(new double[] { 432453254.43243, 4354.7888 }));
            _values.Add(Values.of(new char[] { 'a', 'z' }));
            // ZONED_DATE_TIME
            _values.Add(DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "UTC"));
            // LOCAL_DATE_TIME
            _values.Add(LocalDateTimeValue.localDateTime(2018, 3, 1, 13, 50, 42, 1337));
            // DATE
            _values.Add(DateValue.epochDate(2));
            // ZONED_TIME
            _values.Add(TimeValue.time(43_200_000_000_000L, ZoneOffset.UTC));
            // LOCAL_TIME
            _values.Add(LocalTimeValue.localTime(100000));
            // DURATION
            _values.Add(DurationValue.duration(10, 20, 30, 40));
            // TEXT
            _values.Add(Values.of("string1"));
            // BOOLEAN
            _values.Add(Values.of(true));
            // NUMBER (byte, short, int, long, float, double)
            _values.Add(Values.of(sbyte.MaxValue));
            _values.Add(Values.of(short.MaxValue));
            _values.Add(Values.of(int.MaxValue));
            _values.Add(Values.of(long.MaxValue));
            _values.Add(Values.of(float.MaxValue));
            _values.Add(Values.of(double.MaxValue));
            _values.Add(Values.of(char.MaxValue));
            // GEOMETRY
            _values.Add(Values.pointValue(CoordinateReferenceSystem.WGS84, 12.78, 56.7));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.WGS84, 12.7566548, 56.7163465), Values.pointValue(CoordinateReferenceSystem.WGS84, 12.13413478, 56.1343457) }));
            _values.Add(Values.pointValue(CoordinateReferenceSystem.WGS84_3D, 12.78, 56.7, 666));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.WGS84_3D, 12.7566548, 56.7163465, 666), Values.pointValue(CoordinateReferenceSystem.WGS84_3D, 12.13413478, 56.1343457, 555) }));
            _values.Add(Values.pointValue(CoordinateReferenceSystem.Cartesian, 0.0000043, -0.0000000012341025786543));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.Cartesian, 0.0000043, -0.0000000012341025786543), Values.pointValue(CoordinateReferenceSystem.Cartesian, 0.2000043, -0.0300000012341025786543) }));
            _values.Add(Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 0.0000043, -0.0000000012341025786543, 666));
            _values.Add(Values.pointArray(new PointValue[] { Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 0.0000043, -0.0000000012341025786543, 666), Values.pointValue(CoordinateReferenceSystem.Cartesian_3D, 0.2000043, -0.0300000012341025786543, 555) }));
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            BlackFxOptionSurfaceVolatilities test1 = BlackFxOptionSurfaceVolatilities.of(CURRENCY_PAIR, VAL_DATE_TIME, SURFACE);

            coverImmutableBean(test1);
            BlackFxOptionSurfaceVolatilities test2 = BlackFxOptionSurfaceVolatilities.of(CURRENCY_PAIR.inverse(), ZonedDateTime.of(2015, 12, 21, 11, 15, 0, 0, ZoneId.of("Z")), SURFACE);

            coverBeanEquals(test1, test2);
        }
Пример #10
0
            public Compatibility(IndexProviderCompatibilityTestSuite testSuite, IndexDescriptor descriptor)
            {
                this.TestSuite  = testSuite;
                this.Descriptor = descriptor.WithId(17);
                this.ValueSet1  = AllValues(testSuite.SupportsSpatial(), Arrays.asList(Values.of("string1"), Values.of(42), Values.of(true), Values.of(new char[] { 'a', 'z' }), Values.of(new string[] { "arrayString1", "arraysString2" }), Values.of(new sbyte[] { (sbyte)1, (sbyte)12 }), Values.of(new short[] { 314, 1337 }), Values.of(new int[] { 3140, 13370 }), Values.of(new long[] { 31400, 133700 }), Values.of(new bool[] { true, true })), Arrays.asList(DateValue.epochDate(2), LocalTimeValue.localTime(100000), TimeValue.time(43_200_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_201_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_200_000_000_000L, ZoneOffset.of("+01:00")), TimeValue.time(46_800_000_000_000L, ZoneOffset.UTC), LocalDateTimeValue.localDateTime(2018, 3, 1, 13, 50, 42, 1337), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "UTC"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "Europe/Stockholm"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2015, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 4, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 26, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 13, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 46, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 14, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7475, "+05:00"), DateTimeValue.datetime(2038, 1, 18, 9, 14, 7, 0, "-18:00"), DateTimeValue.datetime(10000, 100, ZoneOffset.ofTotalSeconds(3)), DateTimeValue.datetime(10000, 101, ZoneOffset.ofTotalSeconds(-3)), DurationValue.duration(10, 20, 30, 40), DurationValue.duration(11, 20, 30, 40), DurationValue.duration(10, 21, 30, 40), DurationValue.duration(10, 20, 31, 40), DurationValue.duration(10, 20, 30, 41), Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(2018, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(2017, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }), Values.localDateTimeArray(new DateTime[] { new DateTime(2018, 10, 9, 8, 7, 6, 5), new DateTime(2018, 10, 9, 8, 7, 6, 5) }), Values.timeArray(new OffsetTime[] { OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC) }), Values.dateArray(new LocalDate[] { LocalDate.of(1, 12, 28), LocalDate.of(1, 12, 28) }), Values.localTimeArray(new LocalTime[] { LocalTime.of(9, 28), LocalTime.of(9, 28) }), Values.durationArray(new DurationValue[] { DurationValue.duration(12, 10, 10, 10), DurationValue.duration(12, 10, 10, 10) })), Arrays.asList(Values.pointValue(CoordinateReferenceSystem.Cartesian, 0, 0), Values.pointValue(CoordinateReferenceSystem.WGS84, 12.78, 56.7)));

                this.ValueSet2 = AllValues(testSuite.SupportsSpatial(), Arrays.asList(Values.of("string2"), Values.of(1337), Values.of(false), Values.of(new char[] { 'b', 'c' }), Values.of(new string[] { "someString1", "someString2" }), Values.of(new sbyte[] { (sbyte)9, (sbyte)9 }), Values.of(new short[] { 99, 999 }), Values.of(new int[] { 99999, 99999 }), Values.of(new long[] { 999999, 999999 }), Values.of(new bool[] { false, false })), Arrays.asList(DateValue.epochDate(42), LocalTimeValue.localTime(2000), TimeValue.time(100L, ZoneOffset.UTC), LocalDateTimeValue.localDateTime(2018, 2, 28, 11, 5, 1, 42), DateTimeValue.datetime(1999, 12, 31, 23, 59, 59, 123456789, "Europe/London"), DurationValue.duration(4, 3, 2, 1), Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(999, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(999, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }), Values.localDateTimeArray(new DateTime[] { new DateTime(999, 10, 9, 8, 7, 6, 5), new DateTime(999, 10, 9, 8, 7, 6, 5) }), Values.timeArray(new OffsetTime[] { OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(19, 8, 7, 6, ZoneOffset.UTC) }), Values.dateArray(new LocalDate[] { LocalDate.of(999, 12, 28), LocalDate.of(999, 12, 28) }), Values.localTimeArray(new LocalTime[] { LocalTime.of(19, 28), LocalTime.of(19, 28) }), Values.durationArray(new DurationValue[] { DurationValue.duration(99, 10, 10, 10), DurationValue.duration(99, 10, 10, 10) })), Arrays.asList(Values.pointValue(CoordinateReferenceSystem.Cartesian, 90, 90), Values.pointValue(CoordinateReferenceSystem.WGS84, 9.21, 9.65)));

                PageCacheAndDependenciesRule = (new PageCacheAndDependenciesRule()).with(new DefaultFileSystemRule()).with(testSuite.GetType());
                Random    = new RandomRule();
                RuleChain = RuleChain.outerRule(PageCacheAndDependenciesRule).around(Random);
            }
Пример #11
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            BlackFxOptionSmileVolatilities test1 = BlackFxOptionSmileVolatilities.of(NAME, CURRENCY_PAIR, VAL_DATE_TIME, SMILE_TERM);

            coverImmutableBean(test1);
            BlackFxOptionSmileVolatilities test2 = BlackFxOptionSmileVolatilities.of(FxOptionVolatilitiesName.of("Boo"), CURRENCY_PAIR.inverse(), ZonedDateTime.of(2015, 12, 21, 11, 15, 0, 0, ZoneId.of("Z")), SMILE_TERM);

            coverBeanEquals(test1, test2);
        }
Пример #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void compareGenericKeyState()
        internal virtual void CompareGenericKeyState()
        {
            IList <Value> allValues = Arrays.asList(Values.of("string1"), Values.of(42), Values.of(true), Values.of(new char[] { 'a', 'z' }), Values.of(new string[] { "arrayString1", "arraysString2" }), Values.of(new sbyte[] { ( sbyte )1, ( sbyte )12 }), Values.of(new short[] { 314, 1337 }), Values.of(new int[] { 3140, 13370 }), Values.of(new long[] { 31400, 133700 }), Values.of(new bool[] { false, true }), DateValue.epochDate(2), LocalTimeValue.localTime(100000), TimeValue.time(43_200_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_201_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_200_000_000_000L, ZoneOffset.of("+01:00")), TimeValue.time(46_800_000_000_000L, ZoneOffset.UTC), LocalDateTimeValue.localDateTime(2018, 3, 1, 13, 50, 42, 1337), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "UTC"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "Europe/Stockholm"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2015, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 4, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 26, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 13, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 46, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 14, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7475, "+05:00"), DateTimeValue.datetime(2038, 1, 18, 9, 14, 7, 0, "-18:00"), DateTimeValue.datetime(10000, 100, ZoneOffset.ofTotalSeconds(3)), DateTimeValue.datetime(10000, 101, ZoneOffset.ofTotalSeconds(-3)), DurationValue.duration(10, 20, 30, 40), DurationValue.duration(11, 20, 30, 40), DurationValue.duration(10, 21, 30, 40), DurationValue.duration(10, 20, 31, 40), DurationValue.duration(10, 20, 30, 41), Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(2018, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(2017, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }), Values.localDateTimeArray(new DateTime[] { new DateTime(2018, 10, 9, 8, 7, 6, 5), new DateTime(2018, 10, 9, 8, 7, 6, 5) }), Values.timeArray(new OffsetTime[] { OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC) }), Values.dateArray(new LocalDate[] { LocalDate.of(2018, 12, 28), LocalDate.of(2018, 12, 28) }), Values.localTimeArray(new LocalTime[] { LocalTime.of(9, 28), LocalTime.of(9, 28) }), Values.durationArray(new DurationValue[] { DurationValue.duration(12, 10, 10, 10), DurationValue.duration(12, 10, 10, 10) }));

            allValues.sort(Values.COMPARATOR);

            IList <GenericKey> states = new List <GenericKey>();

            foreach (Value value in allValues)
            {
                GenericKey state = new GenericKey(null);
                state.WriteValue(value, NativeIndexKey.Inclusion.Neutral);
                states.Add(state);
            }
            Collections.shuffle(states);
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            states.sort(GenericKey::compareValueTo);
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IList <Value> sortedStatesAsValues = states.Select(GenericKey::asValue).ToList();

            assertEquals(allValues, sortedStatesAsValues);
        }
Пример #13
0
            public override DateTimeValue buildInternal()
            {
                bool          selectingDate     = fields.containsKey(TemporalFields.Date);
                bool          selectingTime     = fields.containsKey(TemporalFields.Time);
                bool          selectingDateTime = fields.containsKey(TemporalFields.Datetime);
                bool          selectingEpoch    = fields.containsKey(TemporalFields.EpochSeconds) || fields.containsKey(TemporalFields.EpochMillis);
                bool          selectingTimeZone;
                ZonedDateTime result;

                if (selectingDateTime)
                {
                    AnyValue dtField = fields.get(TemporalFields.Datetime);
                    if (!(dtField is TemporalValue))
                    {
                        throw new InvalidValuesArgumentException(string.Format("Cannot construct date time from: {0}", dtField));
                    }
                    TemporalValue dt       = ( TemporalValue )dtField;
                    LocalTime     timePart = dt.getTimePart(_defaultZone).toLocalTime();
                    ZoneId        zoneId   = dt.getZoneId(_defaultZone);
                    result            = ZonedDateTime.of(dt.DatePart, timePart, zoneId);
                    selectingTimeZone = dt.supportsTimeZone();
                }
                else if (selectingEpoch)
                {
                    if (fields.containsKey(TemporalFields.EpochSeconds))
                    {
                        AnyValue epochField = fields.get(TemporalFields.EpochSeconds);
                        if (!(epochField is IntegralValue))
                        {
                            throw new InvalidValuesArgumentException(string.Format("Cannot construct date time from: {0}", epochField));
                        }
                        IntegralValue epochSeconds = ( IntegralValue )epochField;
                        result = AssertValidArgument(() => ZonedDateTime.ofInstant(Instant.ofEpochMilli(epochSeconds.LongValue() * 1000), timezone()));
                    }
                    else
                    {
                        AnyValue epochField = fields.get(TemporalFields.EpochMillis);
                        if (!(epochField is IntegralValue))
                        {
                            throw new InvalidValuesArgumentException(string.Format("Cannot construct date time from: {0}", epochField));
                        }
                        IntegralValue epochMillis = ( IntegralValue )epochField;
                        result = AssertValidArgument(() => ZonedDateTime.ofInstant(Instant.ofEpochMilli(epochMillis.LongValue()), timezone()));
                    }
                    selectingTimeZone = false;
                }
                else if (selectingTime || selectingDate)
                {
                    LocalTime time;
                    ZoneId    zoneId;
                    if (selectingTime)
                    {
                        AnyValue timeField = fields.get(TemporalFields.Time);
                        if (!(timeField is TemporalValue))
                        {
                            throw new InvalidValuesArgumentException(string.Format("Cannot construct time from: {0}", timeField));
                        }
                        TemporalValue t = ( TemporalValue )timeField;
                        time              = t.getTimePart(_defaultZone).toLocalTime();
                        zoneId            = t.getZoneId(_defaultZone);
                        selectingTimeZone = t.supportsTimeZone();
                    }
                    else
                    {
                        time              = LocalTimeValue.DefaultLocalTime;
                        zoneId            = timezone();
                        selectingTimeZone = false;
                    }
                    LocalDate date;
                    if (selectingDate)
                    {
                        AnyValue dateField = fields.get(TemporalFields.Date);
                        if (!(dateField is TemporalValue))
                        {
                            throw new InvalidValuesArgumentException(string.Format("Cannot construct date from: {0}", dateField));
                        }
                        TemporalValue t = ( TemporalValue )dateField;
                        date = t.DatePart;
                    }
                    else
                    {
                        date = DateValue.DefaultCalenderDate;
                    }
                    result = ZonedDateTime.of(date, time, zoneId);
                }
                else
                {
                    result            = defaultZonedDateTime;
                    selectingTimeZone = false;
                }

                if (fields.containsKey(TemporalFields.Week) && !selectingDate && !selectingDateTime && !selectingEpoch)
                {
                    // Be sure to be in the start of the week based year (which can be later than 1st Jan)
                    result = result.with(IsoFields.WEEK_BASED_YEAR, safeCastIntegral(TemporalFields.Year.name(), fields.get(TemporalFields.Year), TemporalFields.Year.defaultValue)).with(IsoFields.WEEK_OF_WEEK_BASED_YEAR, 1).with(ChronoField.DAY_OF_WEEK, 1);
                }

                result = assignAllFields(result);
                if (timezone != null)
                {
                    if (((selectingTime || selectingDateTime) && selectingTimeZone) || selectingEpoch)
                    {
                        try
                        {
                            result = result.withZoneSameInstant(timezone());
                        }
                        catch (DateTimeParseException e)
                        {
                            throw new InvalidValuesArgumentException(e.Message, e);
                        }
                    }
                    else
                    {
                        result = result.withZoneSameLocal(timezone());
                    }
                }
                return(Datetime(result));
            }