@formatjs/ecma402-abstract
Advanced tools
Comparing version 1.6.4 to 1.6.5
16
262.js
@@ -67,3 +67,3 @@ "use strict"; | ||
} | ||
if (Math.abs(time) > 8.64 * 1e16) { | ||
if (Math.abs(time) > 8.64 * 1e15) { | ||
return NaN; | ||
@@ -183,6 +183,3 @@ } | ||
function DayFromYear(y) { | ||
return (365 * (y - 1970) + | ||
Math.floor((y - 1969) / 4) - | ||
Math.floor((y - 1901) / 100) + | ||
Math.floor((y - 1601) / 400)); | ||
return Date.UTC(y, 0) / MS_PER_DAY; | ||
} | ||
@@ -195,3 +192,3 @@ exports.DayFromYear = DayFromYear; | ||
function TimeFromYear(y) { | ||
return MS_PER_DAY * DayFromYear(y); | ||
return Date.UTC(y, 0); | ||
} | ||
@@ -204,8 +201,3 @@ exports.TimeFromYear = TimeFromYear; | ||
function YearFromTime(t) { | ||
var min = Math.ceil(t / MS_PER_DAY / 366); | ||
var y = min; | ||
while (TimeFromYear(y) <= t) { | ||
y++; | ||
} | ||
return y - 1; | ||
return new Date(t).getUTCFullYear(); | ||
} | ||
@@ -212,0 +204,0 @@ exports.YearFromTime = YearFromTime; |
@@ -62,3 +62,3 @@ /** | ||
} | ||
if (Math.abs(time) > 8.64 * 1e16) { | ||
if (Math.abs(time) > 8.64 * 1e15) { | ||
return NaN; | ||
@@ -170,6 +170,3 @@ } | ||
export function DayFromYear(y) { | ||
return (365 * (y - 1970) + | ||
Math.floor((y - 1969) / 4) - | ||
Math.floor((y - 1901) / 100) + | ||
Math.floor((y - 1601) / 400)); | ||
return Date.UTC(y, 0) / MS_PER_DAY; | ||
} | ||
@@ -181,3 +178,3 @@ /** | ||
export function TimeFromYear(y) { | ||
return MS_PER_DAY * DayFromYear(y); | ||
return Date.UTC(y, 0); | ||
} | ||
@@ -189,8 +186,3 @@ /** | ||
export function YearFromTime(t) { | ||
var min = Math.ceil(t / MS_PER_DAY / 366); | ||
var y = min; | ||
while (TimeFromYear(y) <= t) { | ||
y++; | ||
} | ||
return y - 1; | ||
return new Date(t).getUTCFullYear(); | ||
} | ||
@@ -197,0 +189,0 @@ export function DaysInYear(y) { |
MIT License | ||
Copyright (c) 2019 FormatJS | ||
Copyright (c) 2021 FormatJS | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
{ | ||
"name": "@formatjs/ecma402-abstract", | ||
"version": "1.6.4", | ||
"version": "1.6.5", | ||
"description": "A collection of implementation for ECMAScript abstract operations", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
470396
9324