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

jalali-moment

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jalali-moment

Manipulate and convert Jalali and Gregorian date easily

  • 3.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.3K
increased by0.57%
Maintainers
1
Weekly downloads
 
Created
Source

Jalali Moment

Display, parse, manipulate and validate jalali (Persian, Khorshidi, Shamsi) or Gregorian (Miladi) dates and times and also convert Jalali (Persian, Khorshidi, Shamsi) date to Gregorian (Miladi) or vice versa in javascript or typescript. DEMO

Read this in فارسی

MIT License Build Status NPM version Package Quality dependencies Quality dev dependencies Quality Codacy Badge Codacy Badge

How to

  • Install

  • Use jalali moment in

  • Use API

    This plugin provides using jalali and gregorian calendar system together on momentjs api.

    .locale('fa'); it will use jalali calendar system

    .locale('any other locale'); it will use gregorian calendar system

Usage
  • Parse
    // parse gregorian date
    m = moment('1989/1/24', 'YYYY/M/D');// parse a gregorian (miladi) date
    m = moment.from('01/1989/24', 'en', 'MM/YYYY/DD');
    
    // parse jalali date
    m = moment('1367/11/04', 'jYYYY/jMM/jDD');
    m = moment.from('1367/04/11', 'fa', 'YYYY/MM/DD');
    m = moment.from('04/1367/11', 'fa', 'DD/YYYY/MM');
    
  • Display
    m.format('jYYYY/jMM/jDD'); // 1367/11/04
    m.locale('fa').format('YYYY/MM/DD'); // 1367/11/04
    
  • Manipulate
    m.add(1, 'day').locale('fa').format('YYYY/MM/DD'); // 1367/11/05
    
  • Validate
    m.isSame(m.clone()); // true
    
  • Convert
    moment.from('1367/11/04', 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD'); // 1989/01/24
    moment('1989/01/24', 'YYYY/MM/DD').locale('fa').format('YYYY/MM/DD'); // 1367/11/04
    

Keywords

FAQs

Package last updated on 20 Jan 2019

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