Comparing version 1.5.5 to 1.6.0
Changelog | ||
========= | ||
### 1.5.6 (next) | ||
### 1.6.1 (next) | ||
### 1.6.0 | ||
#### public API | ||
* update API: export all public classes/interfaces | ||
* add `IsoChronology#date(temporal)` function | ||
* add export of "internal" APIs needed e.g. for plugins, these should *not* be used by users of the `js-joda` library. | ||
Since we do not consider these a public APIs, they may change without warning! | ||
These internal APIs are exported as the `_` object | ||
### 1.5.5 | ||
@@ -7,0 +17,0 @@ |
{ | ||
"name": "js-joda", | ||
"version": "1.5.5", | ||
"version": "1.6.0", | ||
"description": "a date and time library for javascript", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -17,3 +17,3 @@ Immutable date and time library for javascript | ||
+ js-joda has a lightweight footprint, only **43 kB minified and compressed**, no third party dependencies. | ||
+ js-joda has a lightweight footprint, only **46 kB minified and compressed**, no third party dependencies. | ||
@@ -134,4 +134,6 @@ + js-joda is **fast**. It is about 2 to 10 times faster than other javascript date libraries. | ||
E.g. localDate(isoDate: string), localDate(year: number, month: number, dayOfMonth: number) | ||
* merge methods get and getLong, differ between int and long values make no sense with javascript | ||
* simplify temporal adjusters (amount, etc) by using functions instead of classes or objects | ||
* Merge methods get and getLong, differ between int and long values make no sense with javascript | ||
* Simplify temporal adjusters (amount, etc) by using functions instead of classes or objects | ||
* Replace API getters by [native getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get), | ||
like replace `localDate.year()` by `localDate.year` | ||
* ... | ||
@@ -138,0 +140,0 @@ |
@@ -218,2 +218,15 @@ /** | ||
/** | ||
* Obtains an ISO local date from another date-time object. | ||
* <p> | ||
* This is equivalent to {@link LocalDate#from(TemporalAccessor)}. | ||
* | ||
* @param temporal the date-time object to convert, not null | ||
* @return the ISO local date, not null | ||
* @throws DateTimeException if unable to create the date | ||
*/ | ||
date(temporal) { | ||
return LocalDate.from(temporal); | ||
} | ||
} | ||
@@ -220,0 +233,0 @@ |
@@ -80,2 +80,9 @@ /* | ||
locale() { | ||
return this._locale; | ||
} | ||
setLocale(locale) { | ||
this._locale = locale; | ||
} | ||
//----------------------------------------------------------------------- | ||
@@ -82,0 +89,0 @@ /** |
@@ -110,2 +110,14 @@ /* | ||
/** | ||
* Gets the locale. | ||
* <p> | ||
* This locale is used to control localization in the print output except | ||
* where localization is controlled by the symbols. | ||
* | ||
* @return the locale, not null | ||
*/ | ||
locale() { | ||
return this._locale; | ||
} | ||
//------------------------------------------------------------------------- | ||
@@ -122,3 +134,7 @@ // for testing | ||
setLocale(locale) { | ||
this._locale = locale; | ||
} | ||
} |
@@ -76,6 +76,7 @@ /** | ||
print(context, buf) { | ||
const value = context.getValue(this._field); | ||
if (value == null) { | ||
const contextValue = context.getValue(this._field); | ||
if (contextValue == null) { | ||
return false; | ||
} | ||
const value = this._getValue(context, contextValue); | ||
const symbols = context.symbols(); | ||
@@ -206,2 +207,15 @@ let str = '' + Math.abs(value); | ||
/** | ||
* Gets the value to output. | ||
* (This is needed to allow e.g. ReducedPrinterParser to override this and change the value! | ||
* | ||
* @param context the context | ||
* @param value the value of the field, not null | ||
* @return the value | ||
* @private | ||
*/ | ||
_getValue(context, value) { | ||
return value; | ||
} | ||
/** | ||
* Stores the value. | ||
@@ -274,3 +288,3 @@ * | ||
*/ | ||
getValue(context, value) { | ||
_getValue(context, value) { | ||
const absValue = Math.abs(value); | ||
@@ -304,3 +318,4 @@ let baseValue = this._baseValue; | ||
baseValue = chrono.date(this._baseDate).get(this._field); | ||
context.addChronologyChangedParser(this, value, errorPos, successPos); | ||
// TODO: not implemented?? | ||
// context.addChronologyChangedParser(this, value, errorPos, successPos); | ||
} | ||
@@ -307,0 +322,0 @@ const parseLen = successPos - errorPos; |
@@ -7,3 +7,9 @@ /** | ||
export { | ||
DateTimeException, DateTimeParseException, IllegalArgumentException, IllegalStateException, NullPointerException | ||
ArithmeticException, | ||
DateTimeException, | ||
DateTimeParseException, | ||
IllegalArgumentException, | ||
IllegalStateException, | ||
UnsupportedTemporalTypeException, | ||
NullPointerException | ||
} from './errors'; | ||
@@ -22,2 +28,3 @@ | ||
export { Year } from './Year'; | ||
export { YearConstants } from './YearConstants'; | ||
export { YearMonth } from './YearMonth'; | ||
@@ -33,11 +40,27 @@ export { ZonedDateTime } from './ZonedDateTime'; | ||
export { ChronoLocalDate } from './chrono/ChronoLocalDate'; | ||
export { ChronoLocalDateTime } from './chrono/ChronoLocalDateTime'; | ||
export { ChronoZonedDateTime } from './chrono/ChronoZonedDateTime'; | ||
export { IsoChronology } from './chrono/IsoChronology'; | ||
export { ChronoField } from './temporal/ChronoField'; | ||
export { ChronoUnit } from './temporal/ChronoUnit'; | ||
export { IsoFields } from './temporal/IsoFields'; | ||
export { Temporal } from './temporal/Temporal'; | ||
export { TemporalAccessor } from './temporal/TemporalAccessor'; | ||
export { TemporalAdjuster } from './temporal/TemporalAdjuster'; | ||
export { TemporalAdjusters } from './temporal/TemporalAdjusters'; | ||
export { TemporalAmount } from './temporal/TemporalAmount'; | ||
export { TemporalField } from './temporal/TemporalField'; | ||
export { TemporalQueries } from './temporal/TemporalQueries'; | ||
export { TemporalQuery } from './temporal/TemporalQuery'; | ||
export { TemporalUnit } from './temporal/TemporalUnit'; | ||
export { ValueRange } from './temporal/ValueRange'; | ||
export { DateTimeFormatter } from './format/DateTimeFormatter'; | ||
export { DateTimeFormatterBuilder } from './format/DateTimeFormatterBuilder'; | ||
export { DecimalStyle } from './format/DecimalStyle'; | ||
export { ResolverStyle } from './format/ResolverStyle'; | ||
export { SignStyle } from './format/SignStyle'; | ||
export { TextStyle } from './format/TextStyle'; | ||
@@ -51,1 +74,18 @@ import './_init'; | ||
export const use = bindUse(exports); | ||
// private/internal exports, e.g. for use in plugins | ||
import { MathUtil } from './MathUtil'; | ||
import { StringUtil } from './StringUtil'; | ||
import { DateTimeParseContext } from './format/DateTimeParseContext'; | ||
import { DateTimePrintContext } from './format/DateTimePrintContext'; | ||
import { StringBuilder } from './format/StringBuilder'; | ||
import * as assert from './assert'; | ||
export const _ = { | ||
assert, | ||
DateTimeParseContext, | ||
DateTimePrintContext, | ||
MathUtil, | ||
StringUtil, | ||
StringBuilder, | ||
}; |
@@ -97,8 +97,2 @@ /* | ||
static _validate(years, month, days){ | ||
requireNonNull(years, 'years'); | ||
requireNonNull(month, 'month'); | ||
requireNonNull(days, 'days'); | ||
} | ||
//----------------------------------------------------------------------- | ||
@@ -105,0 +99,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3437828
36487
172