Comparing version 1.18.2 to 1.19.0
# Changelog | ||
## 1.19.0 | ||
* Interval#splitAt now ignores input dates outside the interval | ||
* Don't allow decimals in DateTime creation | ||
## 1.18.2 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "luxon", | ||
"version": "1.18.2", | ||
"version": "1.19.0", | ||
"description": "Immutable date wrapper", | ||
@@ -5,0 +5,0 @@ "author": "Isaac Cambron", |
import { | ||
numberBetween, | ||
integerBetween, | ||
isLeapYear, | ||
@@ -8,3 +8,3 @@ timeObject, | ||
weeksInWeekYear, | ||
isNumber | ||
isInteger | ||
} from "./util.js"; | ||
@@ -102,5 +102,5 @@ import Invalid from "./invalid.js"; | ||
export function hasInvalidWeekData(obj) { | ||
const validYear = isNumber(obj.weekYear), | ||
validWeek = numberBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), | ||
validWeekday = numberBetween(obj.weekday, 1, 7); | ||
const validYear = isInteger(obj.weekYear), | ||
validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), | ||
validWeekday = integerBetween(obj.weekday, 1, 7); | ||
@@ -117,4 +117,4 @@ if (!validYear) { | ||
export function hasInvalidOrdinalData(obj) { | ||
const validYear = isNumber(obj.year), | ||
validOrdinal = numberBetween(obj.ordinal, 1, daysInYear(obj.year)); | ||
const validYear = isInteger(obj.year), | ||
validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); | ||
@@ -129,5 +129,5 @@ if (!validYear) { | ||
export function hasInvalidGregorianData(obj) { | ||
const validYear = isNumber(obj.year), | ||
validMonth = numberBetween(obj.month, 1, 12), | ||
validDay = numberBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); | ||
const validYear = isInteger(obj.year), | ||
validMonth = integerBetween(obj.month, 1, 12), | ||
validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); | ||
@@ -146,7 +146,7 @@ if (!validYear) { | ||
const validHour = | ||
numberBetween(hour, 0, 23) || | ||
integerBetween(hour, 0, 23) || | ||
(hour === 24 && minute === 0 && second === 0 && millisecond === 0), | ||
validMinute = numberBetween(minute, 0, 59), | ||
validSecond = numberBetween(second, 0, 59), | ||
validMillisecond = numberBetween(millisecond, 0, 999); | ||
validMinute = integerBetween(minute, 0, 59), | ||
validSecond = integerBetween(second, 0, 59), | ||
validMillisecond = integerBetween(millisecond, 0, 999); | ||
@@ -153,0 +153,0 @@ if (!validHour) { |
@@ -436,3 +436,2 @@ import { hasFormatToParts, hasIntl, padStart, roundTo, hasRelative } from "./util.js"; | ||
matching = results.find(m => m.type.toLowerCase() === field); | ||
return matching ? matching.value : null; | ||
@@ -439,0 +438,0 @@ } |
@@ -23,2 +23,6 @@ /* | ||
export function isInteger(o) { | ||
return typeof o === "number" && o % 1 === 0; | ||
} | ||
export function isString(o) { | ||
@@ -89,4 +93,4 @@ return typeof o === "string"; | ||
export function numberBetween(thing, bottom, top) { | ||
return isNumber(thing) && thing >= bottom && thing <= top; | ||
export function integerBetween(thing, bottom, top) { | ||
return isInteger(thing) && thing >= bottom && thing <= top; | ||
} | ||
@@ -93,0 +97,0 @@ |
@@ -297,3 +297,6 @@ import DateTime, { friendlyDateTime } from "./datetime.js"; | ||
if (!this.isValid) return []; | ||
const sorted = dateTimes.map(friendlyDateTime).sort(), | ||
const sorted = dateTimes | ||
.map(friendlyDateTime) | ||
.filter(d => this.contains(d)) | ||
.sort(), | ||
results = []; | ||
@@ -300,0 +303,0 @@ let { s } = this, |
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
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
Sorry, the diff of this file is not supported yet
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
2866923
33342