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 - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

40

Document.md

@@ -75,2 +75,38 @@ ## Introduction

#### Aurelia
You can create a value converters like following:
``` typescript
import { valueConverter } from 'aurelia-framework';
var moment = require('jalali-moment');
@valueConverter("date")
export class DateValueConverter {
toView(value: string, format: string = "YYYY/MM/DD", locale: string = "en") {
if (!value)
return null;
let m2 = moment(value).locale(locale);
return m2.format(format);
}
}
```
then use this value converter in your ```html``` files:
```html
<require from="path_to_your_date_value_converter"></require>
<h1 style="direction:ltr">
<span>
${myDate|date:myFormat:options.locale}
</span>
</h1>
```
also, for aurelia developers, there is a plugin, [aurelia-time](https://github.com/shahabganji/aurelia-time), in which there are value converters for jalali-moment and other time and date libraries.
## API

@@ -92,2 +128,4 @@

m = moment('1989/1/24', 'YYYY/M/D');// parse a gregorian (miladi) date
moment.locale('fa');
m = moment('1367/11/4', 'YYYY/M/D');// parse a jalali (persian) date
```

@@ -99,3 +137,3 @@

```js
m.format('jYYYY/jM/jD');// 1367/11/4
m.format('jYYYY/jM/jD');// 1367/11/4
m.format('jMM'); // 11 display jalali month

@@ -102,0 +140,0 @@ m.format('M'); // 1 display miladi month

2

jalali-moment.js

@@ -12,4 +12,2 @@

, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g
, persianDigits = "۰۱۲۳۴۵۶۷۸۹"
, persianMap = persianDigits.split("")
, parseTokenOneOrTwoDigits = /\d\d?/

@@ -16,0 +14,0 @@ , parseTokenOneToThreeDigits = /\d{1,3}/

{
"name": "jalali-moment",
"version": "3.0.1",
"version": "3.0.2",
"description": "Display, parse, manipulate ,validate and convert jalali (Persian, Khorshidi, Shamsi) date and time",

@@ -5,0 +5,0 @@ "author": {

@@ -1,6 +0,6 @@

# Jalali Moment
کتابخانه ای برای تاریخ شمسی (فارسی یا جلالی)
نمایش و تغییر تاریخ و زمان در جاواسکریپت و تبدیل جلالی (شمسی یا خورشیدی) به میلادی و برعکس
# Jalali Moment جلالی مامنت
کتابخانه ای برای تاریخ شمسی یا جلالی یا خورشیدی
نمایش و تغییر تاریخ و زمان در جاواسکریپت و تبدیل جلالی به میلادی و برعکس
## معرفی

@@ -7,0 +7,0 @@ سیستم تاریخ جلالی، دقیق‌ترین تقویم هماهنگ با سال اعتدالی و مبنای گاهشمار ایرانی از قرن پنجم خورشیدی به این صورت انجام می‌گرفته است.

# 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](https://fingerpich.github.io/jalali-moment)
convert Jalali (Persian, Khorshidi, Shamsi) date to Gregorian (Miladi) or vice versa in javascript or typescript. [DEMO](https://fingerpich.github.io/jalali-moment)

@@ -17,46 +17,47 @@ Read this in other languages: [فارسی](./README.fa.md)

## How to use
## How to
- [Install](./Document.md#install)
- How to use jalali moment in
- [node.js](./Document.md#Using-in-Node.js)
- [typescript](./Document.md#typescript)
- [angular](./Document.md#Angular-2-or-4)
- [es5](./Document.md#es5)
- [plunker](./Document.md#Using-in-Plunker)
- [API](./Document.md#api)
- Use jalali moment in
- [Node.js](./Document.md#using-in-nodejs)
- [Typescript](./Document.md#typescript)
- [Angular](./Document.md#angular-2-or-4)
- [Aurelia](./Document.md#aurelia)
- [Es5](./Document.md#es5)
- [Plunker](./Document.md#using-in-plunker)
- [Use API](./Document.md#api)
This plugin provide using jalali and gregorian calendar system together
This plugin provides using jalali and gregorian calendar system together
on [momentjs](https://momentjs.com/docs/) api.
```.locale('fa');``` it will use jalali calendar system
```.locale('any other locale');``` it will use gregorian calendar system
- [Parse](./Document.md#parse)
```js
moment.locale('fa'); // set fa locale for all new moment instances
var m1 = moment("1367/11/04","YYYY/MM/DD");
```
- [Display](./Document.md#display-jalali-or-miladi-date)
```js
m1.format("YYYY/MM/DD"); // 1367/11/04
```
- [Manipulate](./Document.md#manipulate)
```js
m1.add(1, "day").format("YYYY/MM/DD"); // 1367/11/05
```
- [Validate](./Document.md#validate)
```js
m1.isValid(); // true
```
- [jalali to Gregorian](./Document.md#convert-persianjalali--shamsi-khorshidi-to-gregorian-miladi-calendar-system)
```js
moment('1367/11/04', 'YYYY/MM/DD').locale('en').format('YYYY/MM/DD'); // 1989/01/24
//set en locale just for this instance
```
- [Gregorian to jalali](./Document.md#convert-gregorian-miladi-to-jalali-shamsi-persian)
```js
moment.locale('en');
moment('1989/01/24').locale('fa').format('YYYY/MM/DD'); // 1367/11/04
```
#### Usage
- [Parse](./Document.md#parse)
```js
moment.locale('fa'); // set fa locale for all new moment instances
var m1 = moment("1367/11/04","YYYY/MM/DD");
```
- [Display](./Document.md#display-jalali-or-miladi-date)
```js
m1.format("YYYY/MM/DD"); // 1367/11/04
```
- [Manipulate](./Document.md#manipulate)
```js
m1.add(1, "day").format("YYYY/MM/DD"); // 1367/11/05
```
- [Validate](./Document.md#validate)
```js
m1.isSame(m1.clone()); // true
```
- [Convert](./Document.md#convert-persianjalali--shamsi-khorshidi-to-gregorian-miladi-calendar-system)
```js
moment('1367/11/04', 'YYYY/MM/DD').locale('en').format('YYYY/MM/DD'); // 1989/01/24
moment.locale('en');
moment('1989/01/24').locale('fa').format('YYYY/MM/DD'); // 1367/11/04
//set en locale just for this instance
```
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat

@@ -63,0 +64,0 @@ [license-url]: LICENSE

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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