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

@sm-date/date-formatter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sm-date/date-formatter

A light javascript tool for formatting date.

1.0.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

Date Formatter

  • A light javascript tool for formatting date.
  • Zero dependency.
  • TypeScript compatible.

Example

DateFormatter.format('%l %j %F %Y', new Date());
// Sunday 12 October 2014

By default, Date Formatter uses the current browser language. You can force a locale like this:

DateFormatter.setLocale('fr-FR');

You can see examples in example directory.

Install it

With NPM

npm install @sm-date/date-formatter --save
import DateFormatter from '@sm-date/date-formatter';

Otherwise

<script src="https://cdn.jsdelivr.net/npm/@sm-date/date-formatter@1.0/dist/date-formatter.js"></script>

Format

CharacterDescriptionExample
%YA full numeric representation of a year, 4 digits2020
%yA two digit representation of a year20
%dDay of the month, 2 digits with leading zeros01 to 31
%lA full textual representation of the day of the weekSunday through Saturday
%DA textual representation of a day, three lettersMon through Sun
%FA full textual representation of a month, such as January or MarchJanuary through December
%MA short textual representation of a month, three lettersJan through Dec
%mNumeric representation of a month, with leading zeros01 through 12
%nNumeric representation of a month, without leading zeros1 through 12
%G24-hour format of an hour without leading zeros0 through 23
%H24-hour format of an hour with leading zeros00 through 23
%iMinutes with leading zeros00 to 59
%sSeconds with leading zeros00 to 59

Keywords

date

FAQs

Package last updated on 03 Oct 2020

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