Giter VIP home page Giter VIP logo

persian-time-ago's Introduction

persian-time-ago

This package used to format Jalali datetime with *** time ago statement. Eg: 3 ساعت قبل.

GitHub license

Installation

npm i persian-time-ago or yarn add persian-time-ago

Usage

Suppose the current time is equal to 1400-03-17 18:00:00

import datetime  from  'persian-time-ago'

// Previous
datetime('1400-03-17 17:59:59') // 1 ثانیه قبل
datetime('1400-03-17 17:55:00') // 5 دقیقه قبل
datetime('1400-03-17 17:00:00') // 1 ساعت قبل
datetime('1400-03-12 18:00:00') // حدود 5 روز  قبل
datetime('1400-03-08 18:00:00') // حدود 1 هفته  قبل
datetime('1400-02-17 18:00:00') // حدود 1 ماه  قبل
datetime('1399-03-17 18:00:00') // حدود 1 سال  قبل

// Now
datetime('1400-03-17 18:00:00') // اکنون

// Next
datetime('1400-03-17 18:00:01') // 1 ثانیه بعد
datetime('1400-03-17 18:05:00') // 5 دقیقه بعد
datetime('1400-03-17 19:00:00') // 1 ساعت بعد
datetime('1400-03-22 18:00:00') // حدود 5 روز  بعد
datetime('1400-03-28 18:00:00') // حدود 1 هفته بعد
datetime('1400-04-17 18:00:00') // حدود 1 ماه  بعد
datetime('1401-03-17 18:00:00') // حدود 1 سال  بعد

NPM Statistics

NPM

persian-time-ago's People

Contributors

hasanisaeed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

persian-time-ago's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.