New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@reverse/date

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reverse/date - npm Package Compare versions

Comparing version
1.0.0
to
1.1.0
+21
formatDate.js
/**
* A nicely formatted date with time in AM and PM.
* @param {Date} date A date to format.
* @returns {String} The formatted date.
*/
function formatDate(date) {
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
var hour = date.getHours();
var minute = date.getMinutes();
var ampm = hour >= 12 ? 'pm' : 'am';
hour = hour % 12;
hour = hour ? hour : 12; // the hour '0' should be '12'
minute = minute < 10 ? '0' + minute : minute;
return `${year}-${month}-${day} at ${hour}:${minute}${ampm}`;
}
module.exports = formatDate;
+1
-0

@@ -6,2 +6,3 @@ /**

* @param {Number} year The full year.
* @returns {Boolean} Whether or not the provided day is the same day as today.
*/

@@ -8,0 +9,0 @@ function dateEqualsNow(month, date, year) {

/**
* Pads a single digit number with a leading zero.
* @param {String|Number} number The number to pad.
* @returns {String} A padded two digit number with a zero.
*/

@@ -12,2 +13,3 @@ function padout(number) {

* @param {Number} year The year.
* @returns {String} The month and day of easter in a "MM.DD" format.
*/

@@ -14,0 +16,0 @@ function getEasterDate(year) {

+2
-1
module.exports = {
getEasterDate: require('./getEasterDate'),
dateEqualsNow: require('./dateEqualsNow')
dateEqualsNow: require('./dateEqualsNow'),
formatDate: require('./formatDate')
}
{
"name": "@reverse/date",
"version": "1.0.0",
"version": "1.1.0",
"description": "Useful functions for handling dates.",

@@ -23,3 +23,3 @@ "main": "index.js",

},
"gitHead": "932d9456e1ea39c8892d116dea8a444517e3d0cb"
"gitHead": "e497abec1cfe02c057ff3d402b957fe1bbc08cfe"
}
+28
-15

@@ -1,2 +0,2 @@

# reverse-date
# @reverse/date
> Useful functions for handling dates.

@@ -10,4 +10,5 @@

## Table of Contents
- [dateEqualsNow](#dateEqualsNowmonth-date-year)
- [formatDate](#formatDatedate)
- [getEasterDate](#getEasterDateyear)
- [dateEqualsNow](#dateEqualsNowmonth-date-year)

@@ -17,14 +18,2 @@ ---

## Usage
### getEasterDate(year)
> Finds the month and date of easter of that year.
#### Paramerters
- `year: Number`: The email to check.
#### Example
```js
import { getEasterDate } from '@reverse/date';
getEasterDate(2020);
// "04.12"
```
### dateEqualsNow(month, date, year)

@@ -47,2 +36,26 @@ > Checks if a given date is the same date as today.

// false
```
```
### formatDate(date)
> A nicely formatted date with time in AM and PM.
#### Parameters
- `date: Date`: A date to format.
#### Example
```js
import { formatDate } from '@reverse/date';
formatDate(new Date());
// Example Output: "2019-06-21 at 10:53am"
```
### getEasterDate(year)
> Finds the month and date of easter of that year.
#### Paramerters
- `year: Number`: The email to check.
#### Example
```js
import { getEasterDate } from '@reverse/date';
getEasterDate(2020);
// "04.12"
```