Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: change "rounding" explanation to "truncate" #2050

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/add/index.ts
Expand Up @@ -14,7 +14,7 @@ import { Duration } from '../types'
* Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Fractional values are truncated towards zero.
*
* | Key | Description |
* |----------------|------------------------------------|
Expand Down
2 changes: 1 addition & 1 deletion src/addBusinessDays/index.ts
Expand Up @@ -14,7 +14,7 @@ import isSaturday from '../isSaturday/index'
* Add the specified number of business days (mon - fri) to the given date, ignoring weekends.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of business days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of business days to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the business days added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addDays/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of days to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the days added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addHours/index.ts
Expand Up @@ -17,7 +17,7 @@ const MILLISECONDS_IN_HOUR = 3600000
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of hours to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of hours to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the hours added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addISOWeekYears/index.ts
Expand Up @@ -23,7 +23,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* locale-dependent week-numbering year helpers, e.g., `addWeekYears`.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of ISO week-numbering years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of ISO week-numbering years to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the ISO week-numbering years added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addMilliseconds/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of milliseconds to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the milliseconds added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addMinutes/index.ts
Expand Up @@ -17,7 +17,7 @@ const MILLISECONDS_IN_MINUTE = 60000
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of minutes to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of minutes to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the minutes added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addMonths/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of months to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the months added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addQuarters/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of quarters to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of quarters to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the quarters added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addSeconds/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of seconds to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the seconds added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addWeeks/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of weeks to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the weeks added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/addYears/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of years to be added. Fractional values are truncated towards zero.
* @returns {Date} the new date with the years added
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/milliseconds/index.ts
Expand Up @@ -20,7 +20,7 @@ const yearInDays = 365.2425
* @description
* Returns the number of milliseconds in the specified, years, months, weeks, days, hours, minutes and seconds.
*
* @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Fractional values are truncated towards zero.
* @returns {number} the milliseconds
* @throws {TypeError} 1 argument required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subBusinessDays/index.js
Expand Up @@ -11,7 +11,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* Substract the specified number of business days (mon - fri) to the given date, ignoring weekends.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of business days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of business days to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the business days subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subDays/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of days to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the days subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subHours/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of hours to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of hours to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the hours subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subISOWeekYears/index.ts
Expand Up @@ -22,7 +22,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* locale-dependent week-numbering year helpers, e.g., `setWeekYear`.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of ISO week-numbering years to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of ISO week-numbering years to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the ISO week-numbering years subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subMilliseconds/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of milliseconds to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the milliseconds subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subMinutes/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of minutes to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of minutes to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the minutes subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subMonths/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of months to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the months subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subQuarters/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of quarters to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of quarters to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the quarters subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subSeconds/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of seconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of seconds to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the seconds subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subWeeks/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of weeks to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of weeks to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the weeks subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down
2 changes: 1 addition & 1 deletion src/subYears/index.ts
Expand Up @@ -15,7 +15,7 @@ import requiredArgs from '../_lib/requiredArgs/index'
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @param {Number} amount - the amount of years to be subtracted. Fractional values are truncated towards zero.
* @returns {Date} the new date with the years subtracted
* @throws {TypeError} 2 arguments required
*
Expand Down