@js-joda/core
Advanced tools
Comparing version 5.1.0 to 5.2.0
Changelog | ||
========= | ||
### next (upcoming) | ||
### Later version | ||
For later versions check the global [`CHANGELOG.md`](../../CHANGELOG.md) file in the root folder. | ||
### 5.1.0 | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "@js-joda/core", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "a date and time library for javascript", | ||
@@ -51,3 +51,3 @@ "repository": { | ||
}, | ||
"gitHead": "dda0bbb3894919782d859060bbabbaa3859775a8" | ||
"gitHead": "d07153c38a3d0b2b29b8185e3daaac69c624d4a9" | ||
} |
@@ -176,2 +176,16 @@ /** | ||
/** | ||
* Obtains an instance of {@link Instant} using microseconds from the | ||
* epoch of 1970-01-01T00:00:00Z. | ||
* | ||
* @param {number} epochMicro - the number of microseconds from 1970-01-01T00:00:00Z | ||
* @return {Instant} an instant, not null | ||
* @throws DateTimeException if the instant exceeds the maximum or minimum instant | ||
*/ | ||
static ofEpochMicro(epochMicro) { | ||
const secs = MathUtil.floorDiv(epochMicro, 1000000); | ||
const mos = MathUtil.floorMod(epochMicro, 1000000); | ||
return Instant._create(secs, mos * 1000); | ||
} | ||
/** | ||
* Obtains an instance of {@link Instant} from a temporal object. | ||
@@ -529,3 +543,3 @@ * | ||
case ChronoUnit.NANOS: return this.plusNanos(amountToAdd); | ||
case ChronoUnit.MICROS: return this._plus(MathUtil.intDiv(amountToAdd, 1000000), MathUtil.intMod(amountToAdd, 1000000) * 1000); | ||
case ChronoUnit.MICROS: return this.plusMicros(amountToAdd); | ||
case ChronoUnit.MILLIS: return this.plusMillis(amountToAdd); | ||
@@ -584,2 +598,15 @@ case ChronoUnit.SECONDS: return this.plusSeconds(amountToAdd); | ||
/** | ||
* Returns a copy of this instant with the specified duration in microseconds added. | ||
* | ||
* This instance is immutable and unaffected by this method call. | ||
* | ||
* @param {number} microsToAdd - the microseconds to add, positive or negative | ||
* @return {Instant} an {@link Instant} based on this instant with the specified microseconds added, not null | ||
* @throws DateTimeException if the result exceeds the maximum or minimum instant | ||
*/ | ||
plusMicros(microsToAdd) { | ||
return this._plus(MathUtil.intDiv(microsToAdd, 1000000), MathUtil.intMod(microsToAdd, 1000000) * 1000); | ||
} | ||
/** | ||
* Returns a copy of this instant with the specified duration added. | ||
@@ -658,2 +685,16 @@ * | ||
/** | ||
* Returns a copy of this instant with the specified duration in microseconds subtracted. | ||
* | ||
* This instance is immutable and unaffected by this method call. | ||
* | ||
* @param {number} microsToSubtract the microseconds to subtract, positive or negative | ||
* @return {Instant} an {@link Instant} based on this instant with the specified microseconds subtracted, not null | ||
* @throws DateTimeException if the result exceeds the maximum or minimum instant | ||
* @throws ArithmeticException if numeric overflow occurs | ||
*/ | ||
minusMicros(microsToSubtract) { | ||
return this.plusMicros(-1 * microsToSubtract); | ||
} | ||
//------------------------------------------------------------------------- | ||
@@ -660,0 +701,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 not supported yet
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
7472130
87
0
100
61546