Skip to content

Commit

Permalink
added temporal accessor implements to date time
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed Jun 5, 2024
1 parent 99b77dd commit e72fd2a
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/main/java/ortus/boxlang/runtime/types/DateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.TemporalQuery;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
Expand All @@ -55,7 +58,7 @@
* A DateTime object that wraps a ZonedDateTime object and provides additional functionality
* for date time manipulation and formatting the BoxLang way.
*/
public class DateTime implements IType, IReferenceable, Comparable<Object>, Serializable, ValueWriter {
public class DateTime implements IType, IReferenceable, Comparable<Object>, Serializable, ValueWriter, TemporalAccessor {

/**
* --------------------------------------------------------------------------
Expand Down Expand Up @@ -938,4 +941,30 @@ public Class<?> valueType() {
return DateTime.class;
}

/**
* --------------------------------------------------------------------------
* TemporalAccessor Interface Methods
* --------------------------------------------------------------------------
*/

@Override
public boolean isSupported( TemporalField field ) {
return this.wrapped.isSupported( field );
}

@Override
public int get( TemporalField field ) {
return this.wrapped.get( field );
}

@Override
public long getLong( TemporalField field ) {
return this.wrapped.getLong( field );
}

@Override
public <R> R query( TemporalQuery<R> query ) {
return this.wrapped.query( query );
}

}

0 comments on commit e72fd2a

Please sign in to comment.