Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cityssm/modern-julian-date
Converts a regular JavaScript date to the modern Julian date format YYYYDDD.
https://github.com/cityssm/modern-julian-date
banking date-format javascript julian julian-date modern-julian-date yyddd yyyyddd
Last synced: 27 days ago
JSON representation
Converts a regular JavaScript date to the modern Julian date format YYYYDDD.
- Host: GitHub
- URL: https://github.com/cityssm/modern-julian-date
- Owner: cityssm
- License: mit
- Created: 2022-04-11T12:39:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-26T18:37:51.000Z (4 months ago)
- Last Synced: 2024-10-01T18:48:28.273Z (3 months ago)
- Topics: banking, date-format, javascript, julian, julian-date, modern-julian-date, yyddd, yyyyddd
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@cityssm/modern-julian-date
- Size: 193 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Modern Julian Date
[![npm (scoped)](https://img.shields.io/npm/v/@cityssm/modern-julian-date)](https://www.npmjs.com/package/@cityssm/modern-julian-date)
[![DeepSource](https://app.deepsource.com/gh/cityssm/modern-julian-date.svg/?label=active+issues&show_trend=true&token=gVQq0XqtU1PZ2BWi_k-y1so9)](https://app.deepsource.com/gh/cityssm/modern-julian-date/)
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/cityssm/modern-julian-date)](https://codeclimate.com/github/cityssm/modern-julian-date)
[![codecov](https://codecov.io/gh/cityssm/modern-julian-date/graph/badge.svg?token=O2640MNNY0)](https://codecov.io/gh/cityssm/modern-julian-date)Converts a regular JavaScript date to the modern Julian date format YYYYDDD,
commonly seen in banking applications.## Getting Started
```sh
npm install @cityssm/modern-julian-date
```## Usage
```javascript
import {
fromModernJulianDate,
toModernJulianDate,
toShortModernJulianDate
} from "@cityssm/modern-julian-date";/*
* toModernJulianDate()
* Returns date strings in YYYYDDD format.
*/console.log( toModernJulianDate(new Date(2022, 1 - 1, 1)) );
// => '2022001'console.log( toModernJulianDate(new Date(2022, 12 - 1, 31)) );
// => '2022365'console.log( toModernJulianDate(new Date(2020, 12 - 1, 31)) );
// => '2020366'/*
* toShortModernJulianDate()
* Returns date strings in YYDDD format.
*/console.log( toShortModernJulianDate(new Date(2022, 1 - 1, 1)) );
// => '22001'/*
* fromModernJulianDate()
* Returns Date objects.
*/console.log( fromModernJulianDate('2020366') )
// => 'Thu Dec 31 2020 00:00:00 GMT-0500 (Eastern Standard Time)'
```