Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chrono-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrono-utils - npm Package Compare versions

Comparing version 0.0.2 to 1.0.1

lib/getDateFromTimestamp.d.ts

1

lib/index.d.ts
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);

2

package.json
{
"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';

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