All Projects → arashm → JDate

arashm / JDate

Licence: MIT license
A Jalali to Gregorian converter in Javascript with support of formatting output

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to JDate

shamsi date
A Flutter and Dart package for using Jalali (Shamsi, Solar, Persian or Jalaali) calendar. You can convert, format and manipulate Jalali and Gregorian (Miladi) date and times.
Stars: ✭ 59 (-28.92%)
Mutual labels:  solar, jalali
persiantools
Jalali date and datetime with other tools
Stars: ✭ 101 (+21.69%)
Mutual labels:  jalali, jdate
solar-forecasting-RNN
Multi-time-horizon solar forecasting using recurrent neural network
Stars: ✭ 29 (-65.06%)
Mutual labels:  solar
solax
🌞 Solax Inverter API Wrapper
Stars: ✭ 30 (-63.86%)
Mutual labels:  solar
ninja automator
Acquire data with honour and wisdom — using the way of the ninja.
Stars: ✭ 21 (-74.7%)
Mutual labels:  solar
opensolar
Opensolar is a platform powered by openx for funding smart solar infrastructure using the Stellar blockchain.
Stars: ✭ 20 (-75.9%)
Mutual labels:  solar
Solar-system
Solar System simulation created in C++ with legacy OpenGL
Stars: ✭ 26 (-68.67%)
Mutual labels:  solar
tonatiuh
A Monte Carlo ray tracer for the optical simulation of solar concentrating systems
Stars: ✭ 46 (-44.58%)
Mutual labels:  solar
Solar-Calculator
Calculates the sunrise and sunset for a given date and location (using GEO coordinates). This library uses the method outlined NOAA Solar Calculations Day spreadsheet found at http://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html.
Stars: ✭ 36 (-56.63%)
Mutual labels:  solar
python-rctclient
Python client for RCTs Serial Communication Protocol
Stars: ✭ 27 (-67.47%)
Mutual labels:  solar
pvoutput
Python code for downloading PV data from PVOutput.org
Stars: ✭ 22 (-73.49%)
Mutual labels:  solar
imrc-datetime-picker
(Improved) React component datetime picker by momentjs 📆
Stars: ✭ 21 (-74.7%)
Mutual labels:  solar
solarshed
A Python library to help monitor solar charge controllers typically used in off the grid applications.
Stars: ✭ 63 (-24.1%)
Mutual labels:  solar
ha-config-ataraxis
My Home Assistant Configs. If you like what you see, please ⭐️my repo. It would encourage me a lot 🤘
Stars: ✭ 146 (+75.9%)
Mutual labels:  solar
PVMismatch
An explicit Python PV system IV & PV curve trace calculator which can also calculate mismatch.
Stars: ✭ 51 (-38.55%)
Mutual labels:  solar
EnphaseCollector
Enphase Solar Metrics Collector
Stars: ✭ 31 (-62.65%)
Mutual labels:  solar
solar-logger
A datalogger for a solar inverter. Stores data in influxdb and displays it in grafana. Has load diverting capability, to use the inverter's excess power
Stars: ✭ 53 (-36.14%)
Mutual labels:  solar
growatt-esp8266
Growatt Inverter monitoring via MQTT using ESP8266 modbus interface
Stars: ✭ 34 (-59.04%)
Mutual labels:  solar
home assistant omnik solar
Home Assistant Omnik Solar sensor component
Stars: ✭ 15 (-81.93%)
Mutual labels:  solar
solar-system
Various pieces of code that control my home-made solar energy collection system.
Stars: ✭ 15 (-81.93%)
Mutual labels:  solar

JDate

Build Status npm version

A Jalali to Gregorian converter in JavaScript with support of formatting output

Installation

Install via NPM/Yarn:

npm install jalali-date

You could grab the latest version from lib directory and use it:

<head>
  <script src="jdate.js" type="text/javascript" charset="utf-8"></script>
  <script src="jdate.min.js" type="text/javascript" charset="utf-8"></script>
</head>

The full-version is useful for debugging. You may want to use minified version in production as it is smaller.

Initialization

For initializing JDate you may either pass an array of Jalali date to it or a Date object. If no parameter is passed, the default is today:

const JDate = require('jalali-date');
const jdate = new JDate; // => default to today
const jdate2 = new JDate(1393, 10, 11);
const jdate3 = new JDate([1393, 10, 11]);
const jdate4 = new JDate(new Date(2014, 1, 3));

API

jdate.date //=> [1393, 5, 13] An Array of Jalali Date
jdate._d // => Gregorian Date Object

// Getters
jdate.getFullYear() // => 1393
jdate.getMonth() // => 5
jdate.getDate() // => 13
jdate.getDay() // => 1

// Setters
jdate.setFullYear(1394)
jdate.setMonth(6)
jdate.setDate(12)

// Formatting output
jdate.format('dddd DD MMMM YYYY') // => پنج‌شنبه 12 شهریور 1394

// Static functions
JDate.isLeapYear(1393) // => false
JDate.daysInMonth(1393, 5) // => 31
JDate.toGregorian(1393, 12, 11) // => Gregorian Date object
JDate.toJalali(new Date) // => JDate object

Formatting output

Use format() and following conversion identifiers as follows:

date.format('dddd DD MMMM YYYY') //=> دوشنبه 6 امرداد 1393

The conversion identifiers are as follows:

Identifier Description Example
YYY or YYYY Full Year (4 digits) 1393
YY Year (2 digits) 93
M Month in number returns 5 for امرداد
MM Month in number returns 05 for امرداد
MMM or MMMM Month in string امرداد
D Day in number 26
DD Day in number 06
d or dd Abbreviation of day name in string ۱ش (for یکشنبه)
ddd or dddd Full day name in string یکشنبه

Contribute

Report bugs and suggest feature in issue tracker. Feel free to Fork and send Pull Requests.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].