Socket
Socket
Sign inDemoInstall

date-and-time

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-and-time - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

date-and-time.d.ts

145

date-and-time.js

@@ -149,5 +149,5 @@ (function (global, factory) {

/**
* Compiling a format string
* @param {string} formatString - a format string
* @returns {Array.<string>} a compiled object
* Compiling format strings
* @param {string} formatString - A format string
* @returns {Array.<string>} A compiled object
*/

@@ -164,7 +164,7 @@ proto.compile = function (formatString) {

/**
* Formatting a Date and Time
* @param {Date} dateObj - a Date object
* @param {string|Array.<string>} arg - a format string or its compiled object
* @param {boolean} [utc] - output as UTC
* @returns {string} a formatted string
* Formatting date and time objects (Date -> String)
* @param {Date} dateObj - A Date object
* @param {string|Array.<string>} arg - A format string or its compiled object
* @param {boolean} [utc] - Output as UTC
* @returns {string} A formatted string
*/

@@ -186,6 +186,7 @@ proto.format = function (dateObj, arg, utc) {

/**
* Pre-parsing a Date and Time string
* @param {string} dateString - a date string
* @param {string|Array.<string>} arg - a format string or its compiled object
* @returns {Object} a date structure
* Pre-parsing date and time strings
* @param {string} dateString - A date and time string
* @param {string|Array.<string>} arg - A format string or its compiled object
* @param {boolean} [utc] - Input as UTC
* @returns {Object} A pre-parsed result object
*/

@@ -226,7 +227,7 @@ proto.preparse = function (dateString, arg) {

/**
* Parsing a Date and Time string
* @param {string} dateString - a date string
* @param {string|Array.<string>} arg - a format string or its compiled object
* @param {boolean} [utc] - input as UTC
* @returns {Date} a constructed date
* Parsing of date and time string (String -> Date)
* @param {string} dateString - A date-time string
* @param {string|Array.<string>} arg - A format string or its compiled object
* @param {boolean} [utc] - Input as UTC
* @returns {Date} A Date object
*/

@@ -248,6 +249,6 @@ proto.parse = function (dateString, arg, utc) {

/**
* Validation
* @param {Object|string} arg1 - a date structure or a date string
* @param {string|Array.<string>} [arg2] - a format string or its compiled object
* @returns {boolean} whether the date string is a valid date
* Date and time string validation
* @param {Object|string} arg1 - A pre-parsed result object or a date and time string
* @param {string|Array.<string>} [arg2] - A format string or its compiled object
* @returns {boolean} Whether the date and time string is a valid date and time
*/

@@ -267,8 +268,8 @@ proto.isValid = function (arg1, arg2) {

/**
* Transforming a Date and Time string
* @param {string} dateString - a date string
* @param {string|Array.<string>} arg1 - a format string or its compiled object
* @param {string|Array.<string>} arg2 - a transformed format string or its compiled object
* @param {boolean} [utc] - output as UTC
* @returns {string} a formatted string
* Format transformation of date and time string (String -> String)
* @param {string} dateString - A date and time string
* @param {string|Array.<string>} arg1 - A format string or its compiled object before transformation
* @param {string|Array.<string>} arg2 - A format string or its compiled object after transformation
* @param {boolean} [utc] - Output as UTC
* @returns {string} A formatted string
*/

@@ -282,5 +283,5 @@ proto.transform = function (dateString, arg1, arg2, utc) {

* Adding years
* @param {Date} dateObj - a date object
* @param {number} years - number of years to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} years - Number of years to add
* @returns {Date} The Date object after adding the value
*/

@@ -293,5 +294,5 @@ proto.addYears = function (dateObj, years) {

* Adding months
* @param {Date} dateObj - a date object
* @param {number} months - number of months to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} months - Number of months to add
* @returns {Date} The Date object after adding the value
*/

@@ -307,5 +308,5 @@ proto.addMonths = function (dateObj, months) {

* Adding days
* @param {Date} dateObj - a date object
* @param {number} days - number of days to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} days - Number of days to add
* @returns {Date} The Date object after adding the value
*/

@@ -321,5 +322,5 @@ proto.addDays = function (dateObj, days) {

* Adding hours
* @param {Date} dateObj - a date object
* @param {number} hours - number of hours to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} hours - Number of hours to add
* @returns {Date} The Date object after adding the value
*/

@@ -332,5 +333,5 @@ proto.addHours = function (dateObj, hours) {

* Adding minutes
* @param {Date} dateObj - a date object
* @param {number} minutes - number of minutes to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} minutes - Number of minutes to add
* @returns {Date} The Date object after adding the value
*/

@@ -343,5 +344,5 @@ proto.addMinutes = function (dateObj, minutes) {

* Adding seconds
* @param {Date} dateObj - a date object
* @param {number} seconds - number of seconds to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} seconds - Number of seconds to add
* @returns {Date} The Date object after adding the value
*/

@@ -354,5 +355,5 @@ proto.addSeconds = function (dateObj, seconds) {

* Adding milliseconds
* @param {Date} dateObj - a date object
* @param {number} milliseconds - number of milliseconds to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} milliseconds - Number of milliseconds to add
* @returns {Date} The Date object after adding the value
*/

@@ -364,6 +365,6 @@ proto.addMilliseconds = function (dateObj, milliseconds) {

/**
* Subtracting two dates
* @param {Date} date1 - a Date object
* @param {Date} date2 - a Date object
* @returns {Object} a result object subtracting date2 from date1
* Subtracting two dates (date1 - date2)
* @param {Date} date1 - A Date object
* @param {Date} date2 - A Date object
* @returns {Object} The result object of subtracting date2 from date1
*/

@@ -393,5 +394,5 @@ proto.subtract = function (date1, date2) {

/**
* Whether year is leap year
* @param {number} y - year
* @returns {boolean} whether year is leap year
* Whether a year is a leap year
* @param {number} y - A year to check
* @returns {boolean} Whether the year is a leap year
*/

@@ -404,5 +405,5 @@ proto.isLeapYear = function (y) {

* Comparison of two dates
* @param {Date} date1 - a Date object
* @param {Date} date2 - a Date object
* @returns {boolean} whether the two dates are the same day (time is ignored)
* @param {Date} date1 - A Date object
* @param {Date} date2 - A Date object
* @returns {boolean} Whether the two dates are the same day (time is ignored)
*/

@@ -414,6 +415,6 @@ proto.isSameDay = function (date1, date2) {

/**
* Defining new locale
* @param {string} code - language code
* @param {Function} locale - locale installer
* @returns {string} current language code
* Definition of new locale
* @param {string} code - A language code
* @param {Function} locale - A locale installer
* @returns {void}
*/

@@ -427,5 +428,5 @@ proto.locale = function (code, locale) {

/**
* Defining new plugin
* @param {string} name - plugin name
* @param {Function} plugin - plugin installer
* Definition of new plugin
* @param {string} name - A plugin name
* @param {Function} plugin - A plugin installer
* @returns {void}

@@ -443,5 +444,5 @@ */

/**
* Changing locale
* @param {Function|string} [locale] - locale object | language code
* @returns {string} current language code
* Changing locales
* @param {Function|string} [locale] - A locale installer or language code
* @returns {string} The current language code
*/

@@ -472,4 +473,4 @@ date.locale = function (locale) {

/**
* Feature extension
* @param {Object} extension - extension object
* Functional extension
* @param {Object} extension - An extension object
* @returns {void}

@@ -492,4 +493,4 @@ */

/**
* Importing plugin
* @param {Function|string} plugin - plugin object | plugin name
* Importing plugins
* @param {Function|string} plugin - A plugin installer or plugin name
* @returns {void}

@@ -496,0 +497,0 @@ */

@@ -143,5 +143,5 @@ /**

/**
* Compiling a format string
* @param {string} formatString - a format string
* @returns {Array.<string>} a compiled object
* Compiling format strings
* @param {string} formatString - A format string
* @returns {Array.<string>} A compiled object
*/

@@ -158,7 +158,7 @@ proto.compile = function (formatString) {

/**
* Formatting a Date and Time
* @param {Date} dateObj - a Date object
* @param {string|Array.<string>} arg - a format string or its compiled object
* @param {boolean} [utc] - output as UTC
* @returns {string} a formatted string
* Formatting date and time objects (Date -> String)
* @param {Date} dateObj - A Date object
* @param {string|Array.<string>} arg - A format string or its compiled object
* @param {boolean} [utc] - Output as UTC
* @returns {string} A formatted string
*/

@@ -180,6 +180,7 @@ proto.format = function (dateObj, arg, utc) {

/**
* Pre-parsing a Date and Time string
* @param {string} dateString - a date string
* @param {string|Array.<string>} arg - a format string or its compiled object
* @returns {Object} a date structure
* Pre-parsing date and time strings
* @param {string} dateString - A date and time string
* @param {string|Array.<string>} arg - A format string or its compiled object
* @param {boolean} [utc] - Input as UTC
* @returns {Object} A pre-parsed result object
*/

@@ -220,7 +221,7 @@ proto.preparse = function (dateString, arg) {

/**
* Parsing a Date and Time string
* @param {string} dateString - a date string
* @param {string|Array.<string>} arg - a format string or its compiled object
* @param {boolean} [utc] - input as UTC
* @returns {Date} a constructed date
* Parsing of date and time string (String -> Date)
* @param {string} dateString - A date-time string
* @param {string|Array.<string>} arg - A format string or its compiled object
* @param {boolean} [utc] - Input as UTC
* @returns {Date} A Date object
*/

@@ -242,6 +243,6 @@ proto.parse = function (dateString, arg, utc) {

/**
* Validation
* @param {Object|string} arg1 - a date structure or a date string
* @param {string|Array.<string>} [arg2] - a format string or its compiled object
* @returns {boolean} whether the date string is a valid date
* Date and time string validation
* @param {Object|string} arg1 - A pre-parsed result object or a date and time string
* @param {string|Array.<string>} [arg2] - A format string or its compiled object
* @returns {boolean} Whether the date and time string is a valid date and time
*/

@@ -261,8 +262,8 @@ proto.isValid = function (arg1, arg2) {

/**
* Transforming a Date and Time string
* @param {string} dateString - a date string
* @param {string|Array.<string>} arg1 - a format string or its compiled object
* @param {string|Array.<string>} arg2 - a transformed format string or its compiled object
* @param {boolean} [utc] - output as UTC
* @returns {string} a formatted string
* Format transformation of date and time string (String -> String)
* @param {string} dateString - A date and time string
* @param {string|Array.<string>} arg1 - A format string or its compiled object before transformation
* @param {string|Array.<string>} arg2 - A format string or its compiled object after transformation
* @param {boolean} [utc] - Output as UTC
* @returns {string} A formatted string
*/

@@ -276,5 +277,5 @@ proto.transform = function (dateString, arg1, arg2, utc) {

* Adding years
* @param {Date} dateObj - a date object
* @param {number} years - number of years to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} years - Number of years to add
* @returns {Date} The Date object after adding the value
*/

@@ -287,5 +288,5 @@ proto.addYears = function (dateObj, years) {

* Adding months
* @param {Date} dateObj - a date object
* @param {number} months - number of months to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} months - Number of months to add
* @returns {Date} The Date object after adding the value
*/

@@ -301,5 +302,5 @@ proto.addMonths = function (dateObj, months) {

* Adding days
* @param {Date} dateObj - a date object
* @param {number} days - number of days to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} days - Number of days to add
* @returns {Date} The Date object after adding the value
*/

@@ -315,5 +316,5 @@ proto.addDays = function (dateObj, days) {

* Adding hours
* @param {Date} dateObj - a date object
* @param {number} hours - number of hours to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} hours - Number of hours to add
* @returns {Date} The Date object after adding the value
*/

@@ -326,5 +327,5 @@ proto.addHours = function (dateObj, hours) {

* Adding minutes
* @param {Date} dateObj - a date object
* @param {number} minutes - number of minutes to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} minutes - Number of minutes to add
* @returns {Date} The Date object after adding the value
*/

@@ -337,5 +338,5 @@ proto.addMinutes = function (dateObj, minutes) {

* Adding seconds
* @param {Date} dateObj - a date object
* @param {number} seconds - number of seconds to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} seconds - Number of seconds to add
* @returns {Date} The Date object after adding the value
*/

@@ -348,5 +349,5 @@ proto.addSeconds = function (dateObj, seconds) {

* Adding milliseconds
* @param {Date} dateObj - a date object
* @param {number} milliseconds - number of milliseconds to add
* @returns {Date} a date after adding the value
* @param {Date} dateObj - A Date object
* @param {number} milliseconds - Number of milliseconds to add
* @returns {Date} The Date object after adding the value
*/

@@ -358,6 +359,6 @@ proto.addMilliseconds = function (dateObj, milliseconds) {

/**
* Subtracting two dates
* @param {Date} date1 - a Date object
* @param {Date} date2 - a Date object
* @returns {Object} a result object subtracting date2 from date1
* Subtracting two dates (date1 - date2)
* @param {Date} date1 - A Date object
* @param {Date} date2 - A Date object
* @returns {Object} The result object of subtracting date2 from date1
*/

@@ -387,5 +388,5 @@ proto.subtract = function (date1, date2) {

/**
* Whether year is leap year
* @param {number} y - year
* @returns {boolean} whether year is leap year
* Whether a year is a leap year
* @param {number} y - A year to check
* @returns {boolean} Whether the year is a leap year
*/

@@ -398,5 +399,5 @@ proto.isLeapYear = function (y) {

* Comparison of two dates
* @param {Date} date1 - a Date object
* @param {Date} date2 - a Date object
* @returns {boolean} whether the two dates are the same day (time is ignored)
* @param {Date} date1 - A Date object
* @param {Date} date2 - A Date object
* @returns {boolean} Whether the two dates are the same day (time is ignored)
*/

@@ -408,6 +409,6 @@ proto.isSameDay = function (date1, date2) {

/**
* Defining new locale
* @param {string} code - language code
* @param {Function} locale - locale installer
* @returns {string} current language code
* Definition of new locale
* @param {string} code - A language code
* @param {Function} locale - A locale installer
* @returns {void}
*/

@@ -421,5 +422,5 @@ proto.locale = function (code, locale) {

/**
* Defining new plugin
* @param {string} name - plugin name
* @param {Function} plugin - plugin installer
* Definition of new plugin
* @param {string} name - A plugin name
* @param {Function} plugin - A plugin installer
* @returns {void}

@@ -437,5 +438,5 @@ */

/**
* Changing locale
* @param {Function|string} [locale] - locale object | language code
* @returns {string} current language code
* Changing locales
* @param {Function|string} [locale] - A locale installer or language code
* @returns {string} The current language code
*/

@@ -466,4 +467,4 @@ date.locale = function (locale) {

/**
* Feature extension
* @param {Object} extension - extension object
* Functional extension
* @param {Object} extension - An extension object
* @returns {void}

@@ -486,4 +487,4 @@ */

/**
* Importing plugin
* @param {Function|string} plugin - plugin object | plugin name
* Importing plugins
* @param {Function|string} plugin - A plugin installer or plugin name
* @returns {void}

@@ -490,0 +491,0 @@ */

@@ -57,3 +57,3 @@ /**

}
return NaN;
return new Date(NaN);
};

@@ -60,0 +60,0 @@ var transformTZ = function (dateString, arg1, arg2, timeZone) {

{
"name": "date-and-time",
"version": "2.2.1",
"version": "2.3.0",
"description": "A Minimalist DateTime utility for Node.js and the browser",
"main": "date-and-time.js",
"module": "esm/date-and-time.es.js",
"types": "date-and-time.d.ts",
"unpkg": "date-and-time.min.js",

@@ -27,3 +28,4 @@ "exports": {

"build": "rollup --config rollup.config.js",
"test": "./test.sh"
"test": "./test.sh",
"test:ts": "tsd ./test/ts"
},

@@ -52,4 +54,5 @@ "repository": {

"mocha-headless-chrome": "^4.0.0",
"rollup": "^2.68.0"
"rollup": "^2.70.0",
"tsd": "^0.19.1"
}
}

@@ -63,3 +63,3 @@ (function (global, factory) {

}
return NaN;
return new Date(NaN);
};

@@ -66,0 +66,0 @@ var transformTZ = function (dateString, arg1, arg2, timeZone) {

# Plugins
This library is oriented towards minimalism, so it may seem to some developers to be lacking in features. Plugin is the most realistic solution to such dissatisfaction. By importing plugins, you can extend the functionality of this library, mainly a formatter and a parser.
This library is oriented towards minimalism, so it may seem to some developers to be lacking in features. The plugin is the most realistic solution to such dissatisfaction. By importing plugins, you can extend the functionality of this library, primarily the formatter and parser.

@@ -241,5 +241,5 @@ *The formatter is used in `format()`, etc., the parser is used in `parse()`, `preparse()`, `isValid()`, etc.*

- @param {**Date**} date1 - a Date object
- @param {**Date**} date2 - a Date object
- @returns {**Object**} a result object subtracting date2 from date1
- @param {**Date**} date1 - A Date object
- @param {**Date**} date2 - A Date object
- @returns {**Object**} The result object of subtracting date2 from date1

@@ -266,7 +266,7 @@ ```javascript

|:---------------|:------------------------|
| toDays | Outputs as dates |
| toHours | Outputs as hours |
| toMinutes | Outputs as minutes |
| toSeconds | Outputs as seconds |
| toMilliseconds | Outputs as milliseconds |
| toDays | Outputs in dates |
| toHours | Outputs in hours |
| toMinutes | Outputs in minutes |
| toSeconds | Outputs in seconds |
| toMilliseconds | Outputs in milliseconds |

@@ -299,6 +299,6 @@ In these functions can be available some tokens to format the calculation result. Here are the tokens and their meanings:

- @param {**Date**} dateObj - a Date object
- @param {**string|Array.\<string\>**} arg - a format string or its compiled object
- @param {**string**} [timeZone] - output as this time zone
- @returns {**string**} a formatted string
- @param {**Date**} dateObj - A Date object
- @param {**string|Array.\<string\>**} arg - A format string or its compiled object
- @param {**string**} [timeZone] - Output as this time zone
- @returns {**string**} A formatted string

@@ -309,6 +309,6 @@ `formatTZ()` is upward compatible with `format()`. Tokens available for `arg` are the same as those for `format()`. If `timeZone` is omitted, this function assumes `timeZone` to be a local time zone and outputs a string. This means that the result is the same as when `format()` is used.

- @param {**string**} dateString - a date string
- @param {**string|Array.\<string\>**} arg - a format string or its compiled object
- @param {**string**} [timeZone] - input as this time zone
- @returns {**Date**} a constructed date
- @param {**string**} dateString - A date and time string
- @param {**string|Array.\<string\>**} arg - A format string or its compiled object
- @param {**string**} [timeZone] - Input as this time zone
- @returns {**Date**} A Date object

@@ -319,7 +319,7 @@ `parseTZ()` is upward compatible with `parse()`. Tokens available for `arg` are the same as those for `parse()`. `timeZone` in this function is used as supplemental information. if `dateString` contains a time zone offset value (i.e. -0800, +0900), `timeZone` is not be used. If `dateString` doesn't contain a time zone offset value and `timeZone` is omitted, this function assumes `timeZone` to be a local time zone. This means that the result is the same as when `parse()` is used.

- @param {**string**} dateString - a date string
- @param {**string|Array.\<string\>**} arg1 - a format string or its compiled object
- @param {**string|Array.\<string\>**} arg2 - a transformed format string or its compiled object
- @param {**string**} [timeZone] - output as this time zone
- @returns {**string**} a formatted string
- @param {**string**} dateString - A date and time string
- @param {**string|Array.\<string\>**} arg1 - A format string before transformation or its compiled object
- @param {**string|Array.\<string\>**} arg2 - A format string after transformation or its compiled object
- @param {**string**} [timeZone] - Output as this time zone
- @returns {**string**} A formatted string

@@ -326,0 +326,0 @@ `transformTZ()` is upward compatible with `transform()`. `dateString` must itself contain a time zone offset value (i.e. -0800, +0900), otherwise this function assumes it is a local time zone. Tokens available for `arg1` are the same as those for `parse()`, also tokens available for `arg2` are the same as those for `format()`. `timeZone` is a `IANA time zone names`, which is required to output a new formatted string. If it is omitted, this function assumes `timeZone` to be a local time zone. This means that the result is the same as when `transform()` is used.

@@ -27,4 +27,8 @@ # date-and-time

- 2.3.0
- TypeScript support.
- Fixed an issue where `parseTZ()` in timezone plugin could return `NaN` instead of `Invalid Date` if parsing failed.
- 2.2.1
- Fixed an issue where `parse()` would treat a date-time string containing a UTC time zone (i.e. +0000) as a local time zone when parsing it.
- Fixed an issue where `parse()` would treat a date and time string containing a UTC time zone (i.e. +0000) as a local time zone when parsing.

@@ -35,5 +39,2 @@ - 2.2.0

- 2.1.2
- Fixed an issue where the lib's validation logic would consider an error when a time zone offset value of a date-time string was greater than +12 hours.
## Usage

@@ -64,3 +65,5 @@

```html
<script src="/path/to/date-and-time.min.js"></script>
<script src="/path/to/date-and-time.min.js">
// You will be able to access the global variable `date`.
</script>
```

@@ -70,3 +73,3 @@

- If you want to use ES Modules in Node.js without a transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.
- If you want to use ES Modules in Node.js without the transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.

@@ -76,18 +79,18 @@ ## API

- [format](#formatdateobj-arg-utc)
- Formatting a Date and Time (Date -> String)
- Formatting date and time objects (Date -> String)
- [parse](#parsedatestring-arg-utc)
- Parsing a Date and Time string (String -> Date)
- Parsing date and time strings (String -> Date)
- [compile](#compileformatstring)
- Compiling a format string
- Compiling format strings
- [preparse](#preparsedatestring-arg)
- Pre-parsing a Date and Time string
- Pre-parsing date and time strings
- [isValid](#isvalidarg1-arg2)
- Validation
- Date and time string validation
- [transform](#transformdatestring-arg1-arg2-utc)
- Transforming a Date and Time string (String -> String)
- Format transformation of date and time strings (String -> String)

@@ -116,6 +119,6 @@ - [addYears](#addyearsdateobj-years)

- [subtract](#subtractdate1-date2)
- Subtracting two dates
- Subtracting two dates (date1 - date2)
- [isLeapYear](#isleapyeary)
- Whether year is leap year
- Whether a year is a leap year

@@ -125,17 +128,17 @@ - [isSameDay](#issamedaydate1-date2)

- [locale](#localecode-locale)
- Changing the locale or defining new locales
- [locale](#localelocale)
- Changing locales
- [extend](#extendextension)
- Feature extension
- Functional extension
- [plugin](#pluginname-plugin)
- Importing or defining plugins
- [plugin](#pluginplugin)
- Importing plugins
### format(dateObj, arg[, utc])
- @param {**Date**} dateObj - a Date object
- @param {**string|Array.\<string\>**} arg - a format string or its compiled object
- @param {**boolean**} [utc] - output as UTC
- @returns {**string**} a formatted string
- @param {**Date**} dateObj - A Date object
- @param {**string|Array.\<string\>**} arg - A format string or its compiled object
- @param {**boolean**} [utc] - Output as UTC
- @returns {**string**} A formatted string

@@ -204,3 +207,3 @@ ```javascript

This function usually outputs a local date-time string. Set to true the `utc` option (the 3rd parameter) if you would like to get a UTC date-time string.
This function usually outputs a local date and time string. Set to true the `utc` option (the 3rd parameter) if you would like to get a UTC date and time string.

@@ -218,6 +221,6 @@ ```javascript

- @param {**string**} dateString - a date string
- @param {**string|Array.\<string\>**} arg - a format string or its compiled object
- @param {**boolean**} [utc] - input as UTC
- @returns {**Date**} a constructed date
- @param {**string**} dateString - A date and time string
- @param {**string|Array.\<string\>**} arg - A format string or its compiled object
- @param {**boolean**} [utc] - Input as UTC
- @returns {**Date**} A Date object

@@ -290,3 +293,3 @@ ```javascript

This function assumes the `dateString` is a local date-time unless it contains a time zone offset value. Set to true the `utc` option (the 3rd parameter) if it is a UTC date-time.
This function assumes the `dateString` is a local datea and time unless it contains a time zone offset value. Set to true the `utc` option (the 3rd parameter) if it is a UTC date and time.

@@ -330,3 +333,3 @@ ```javascript

Use square brackets `[]` if a date-time string includes some token characters. Tokens inside square brackets in the `formatString` will be interpreted as normal characters:
Use square brackets `[]` if a datea and time string includes some token characters. Tokens inside square brackets in the `formatString` will be interpreted as normal characters:

@@ -359,4 +362,4 @@ ```javascript

- @param {**string**} formatString - a format string
- @returns {**Array.\<string\>**} a compiled object
- @param {**string**} formatString - A format string
- @returns {**Array.\<string\>**} A compiled object

@@ -377,5 +380,5 @@ If you are going to execute the `format()`, the `parse()` or the `isValid()` so many times with one string format, recommended to precompile and reuse it for performance.

- @param {**string**} dateString - a date string
- @param {**string|Array.\<string\>**} arg - a format string or its compiled object
- @returns {**Object**} a date structure
- @param {**string**} dateString - A date and time string
- @param {**string|Array.\<string\>**} arg - A format string or its compiled object
- @returns {**Object**} A pre-parsed result object

@@ -408,5 +411,5 @@ This function takes exactly the same parameters with the `parse()`, but returns a date structure as follows unlike that:

- @param {**Object|string**} arg1 - a date structure or a date string
- @param {**string|Array.\<string\>**} [arg2] - a format string or its compiled object
- @returns {**boolean**} whether the date string is a valid date
- @param {**Object|string**} arg1 - A pre-parsed result object or a date and time string
- @param {**string|Array.\<string\>**} [arg2] - A format string or its compiled object
- @returns {**boolean**} Whether the date and time string is a valid date and time

@@ -427,7 +430,7 @@ This function takes either exactly the same parameters with the `parse()` or a date structure which the `preparse()` returns, evaluates the validity of them.

- @param {**string**} dateString - a date string
- @param {**string|Array.\<string\>**} arg1 - a format string or its compiled object
- @param {**string|Array.\<string\>**} arg2 - a transformed format string or its compiled object
- @param {**boolean**} [utc] - output as UTC
- @returns {**string**} a formatted string
- @param {**string**} dateString - A date and time string
- @param {**string|Array.\<string\>**} arg1 - A format string or its compiled object before transformation
- @param {**string|Array.\<string\>**} arg2 - A format string or its compiled object after transformation
- @param {**boolean**} [utc] - Output as UTC
- @returns {**string**} A formatted string

@@ -446,5 +449,5 @@ This function transforms the format of a date string. The 2nd parameter, `arg1`, is the format string of it. Available token list is equal to the `parse()`'s. The 3rd parameter, `arg2`, is the transformed format string. Available token list is equal to the `format()`'s.

- @param {**Date**} dateObj - a Date object
- @param {**number**} years - number of years to add
- @returns {**Date**} a date after adding the value
- @param {**Date**} dateObj - A Date object
- @param {**number**} years - Number of years to add
- @returns {**Date**} The Date object after adding the value

@@ -458,5 +461,5 @@ ```javascript

- @param {**Date**} dateObj - a Date object
- @param {**number**} months - number of months to add
- @returns {**Date**} a date after adding the value
- @param {**Date**} dateObj - A Date object
- @param {**number**} months - Number of months to add
- @returns {**Date**} The Date object after adding the value

@@ -470,5 +473,5 @@ ```javascript

- @param {**Date**} dateObj - a Date object
- @param {**number**} days - number of days to add
- @returns {**Date**} a date after adding the value
- @param {**Date**} dateObj - A Date object
- @param {**number**} days - Number of days to add
- @returns {**Date**} The Date object after adding the value

@@ -482,5 +485,5 @@ ```javascript

- @param {**Date**} dateObj - a Date object
- @param {**number**} hours - number of hours to add
- @returns {**Date**} a date after adding the value
- @param {**Date**} dateObj - A Date object
- @param {**number**} hours - Number of hours to add
- @returns {**Date**} The Date object after adding the value

@@ -494,5 +497,5 @@ ```javascript

- @param {**Date**} dateObj - a Date object
- @param {**number**} minutes - number of minutes to add
- @returns {**Date**} a date after adding the value
- @param {**Date**} dateObj - A Date object
- @param {**number**} minutes - Number of minutes to add
- @returns {**Date**} The Date object after adding the value

@@ -506,5 +509,5 @@ ```javascript

- @param {**Date**} dateObj - a Date object
- @param {**number**} seconds - number of seconds to add
- @returns {**Date**} a date after adding the value
- @param {**Date**} dateObj - A Date object
- @param {**number**} seconds - Number of seconds to add
- @returns {**Date**} The Date object after adding the value

@@ -518,5 +521,5 @@ ```javascript

- @param {**Date**} dateObj - a Date object
- @param {**number**} milliseconds - number of milliseconds to add
- @returns {**Date**} a date after adding the value
- @param {**Date**} dateObj - A Date object
- @param {**number**} milliseconds - Number of milliseconds to add
- @returns {**Date**} The Date object after adding the value

@@ -530,5 +533,5 @@ ```javascript

- @param {**Date**} date1 - a Date object
- @param {**Date**} date2 - a Date object
- @returns {**Object**} a result object subtracting date2 from date1
- @param {**Date**} date1 - A Date object
- @param {**Date**} date2 - A Date object
- @returns {**Object**} The result object of subtracting date2 from date1

@@ -548,4 +551,4 @@ ```javascript

- @param {**number**} y - year
- @returns {**boolean**} whether year is leap year
- @param {**number**} y - A year to check
- @returns {**boolean**} Whether the year is a leap year

@@ -559,5 +562,5 @@ ```javascript

- @param {**Date**} date1 - a Date object
- @param {**Date**} date2 - a Date object
- @returns {**boolean**} whether the two dates are the same day (time is ignored)
- @param {**Date**} date1 - A Date object
- @param {**Date**} date2 - A Date object
- @returns {**boolean**} Whether the two dates are the same day (time is ignored)

@@ -572,7 +575,6 @@ ```javascript

### locale([code[, locale]])
### locale([locale])
- @param {**Function|string**} [code] - locale installer | language code
- @param {**Object**} [locale] - locale definition
- @returns {**string**} current language code
- @param {**Function|string**} [locale] - A locale installer or language code
- @returns {**string**} The current language code

@@ -597,3 +599,3 @@ It returns the current language code if called without any parameters.

- @param {**Object**} extension - extension object
- @param {**Object**} extension - An extension object
- @returns {**void**}

@@ -603,6 +605,5 @@

### plugin(name[, plugin])
### plugin(plugin)
- @param {**Function|string**} name - plugin installer | plugin name
- @param {**Object**} [plugin] - plugin object
- @param {**Function|string**} plugin - A plugin installer or plugin name
- @returns {**void**}

@@ -609,0 +610,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc