chrono-utils
Advanced tools
Comparing version 0.0.2 to 1.0.1
export * from './convertDateToUnixTimestamp'; | ||
export * from './datesWithinMaximumRange'; | ||
export * from './getCurrentDate'; | ||
export * from './getDateFromTimestamp'; | ||
export * from './getDateYesterday'; | ||
@@ -5,0 +6,0 @@ export * from './getDiffInSeconds'; |
@@ -20,2 +20,3 @@ "use strict"; | ||
__exportStar(require("./getCurrentDate"), exports); | ||
__exportStar(require("./getDateFromTimestamp"), exports); | ||
__exportStar(require("./getDateYesterday"), exports); | ||
@@ -22,0 +23,0 @@ __exportStar(require("./getDiffInSeconds"), exports); |
{ | ||
"name": "chrono-utils", | ||
"description": "Collects a number of helpful date and time utilities for TypeScript/Javascript.", | ||
"version": "0.0.2", | ||
"version": "1.0.1", | ||
"author": "Mikael Vesavuori", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -7,3 +7,3 @@ # `chrono-utils` 🕰️ 🥷 ⌚ | ||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mikaelvesavuori_chrono-utils&metric=alert_status)](https://sonarcloud.io/dashboard?id=mikaelvesavuori_chrono-utils) | ||
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/quality_gate?project=mikaelvesavuori_date-time-utils)](https://sonarcloud.io/summary/new_code?id=mikaelvesavuori_date-time-utils) | ||
@@ -22,4 +22,23 @@ [![CodeScene Code Health](https://codescene.io/projects/33643/status-badges/code-health)](https://codescene.io/projects/33643) | ||
## Functions | ||
## Usage | ||
### Installation | ||
Run `npm install chrono-utils`. Exchange `npm` with your chosen package manager if needed. | ||
### Basic importing and usage | ||
```typescript | ||
// ES5 format | ||
const { convertDateToUnixTimestamp } = require('chrono-utils'); | ||
// ES6 format | ||
import { convertDateToUnixTimestamp } from 'chrono-utils'; | ||
convertDateToUnixTimestamp('2021-12-31T10:01:37Z'); | ||
``` | ||
## Overview of functions | ||
The below explains each of the functions in `chrono-utils` and shows examples of their output. | ||
### `convertDateToUnixTimestamp` | ||
@@ -48,2 +67,12 @@ | ||
### `getDateFromTimestamp` | ||
Takes a timestamp and returns the current date in `YYYYMMDD` format. | ||
```ts | ||
import { getDateFromTimestamp } from 'chrono-utils'; | ||
getDateFromTimestamp('1664928000'); // '20221005' | ||
``` | ||
### `getCurrentDate` | ||
@@ -170,4 +199,2 @@ | ||
All fields will be double-digit, but it is possible that double-digit `DD` will in fact be three-digit `DDD` if the day count is huge (i.e. over 99). | ||
```ts | ||
@@ -174,0 +201,0 @@ import { prettifyTime } from 'chrono-utils'; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24724
39
328
0
222