Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

afghan-date

bashirrezaie7MIT1.0.8

A lightweight library for converting gregorian date to afghan local date. Includes Dari and Pashto locales.

Dari, Afghan, Pashto, Date, Time, Locale, Farsi, Persian, Datetime, Convert, Afghan-date, Pashto-date

readme

Afghan Date

Installation

npm install afghan-date

Usage

import AfghanDate from "afghan-date";

Dari

const date = new AfghanDate('2018-12-19', 'dr');

const localDate = date.getDate(); // 1397-9-27

const localMonthName = date.getMonthName(); // قوس

Pashto

const date = new AfghanDate('2018-12-19', 'ps');

const localDate = date.getDate(); // 1397-9-27

const localMonthName = date.getMonthName(); // لیند

Api

getDate() // returns the locale date

getYear() // returns the locale date year

getMonth() // returns the locale date month

getMonthName() // returns the locale date month name