New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@arturdoruch/date

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arturdoruch/date

JavaScript date helpers.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Date

JavaScript date helpers.

Install

yarn add @arturdoruch/date

Contents

Date polyfills

import '@arturdoruch/date/lib/date-polyfills';

Adds useful methods to the native Date object.

  • createFromTimestamp - Creates Date from a timestamp.

  • format - Formats Date into a string.

  • modify - Modifies date time.

  • getTimestamp - Gets date Unix timestamp.

Date parser

Parses date string into Date object.

Usage
import dateParser from '@arturdoruch/date/lib/date-parser';

dateParser.parse('2020-06-01');
dateParser.parse('2020-06-01 15:00:00');
dateParser.parse('February 23rd, 2014 11:32 PM');
dateParser.parse('Yesterday, 18:00');
dateParser.parse('day ago');
dateParser.parse('2 months ago');
Functions
  • registerMonthNames - Registers month names in a specified language, in order to correctly parse date with month name in language other, then english or polish.
  • registerDayNames - Registers day names (yesterday, today, tomorrow) in a specified language, in order to correctly parse date with day name in language other, then english or polish.
  • registerTimeAgoPhrases - Registers phrases in a specified language, in order to correctly parse date with "time ago" phrase, like: "20 hours ago", "month ago" in language other, then english or polish.

See functions description for more info.

Date utils

import dateUtils from '@arturdoruch/date/lib/date-utils';
Functions
  • getMonthNumber
  • getMonthName
  • generateDateRange
  • getTimezoneOffset

Keywords

FAQs

Package last updated on 19 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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