Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/intevel/dtg-format
📆 Convert date to DTG
https://github.com/intevel/dtg-format
date date-format dtg format javascript nato
Last synced: about 14 hours ago
JSON representation
📆 Convert date to DTG
- Host: GitHub
- URL: https://github.com/intevel/dtg-format
- Owner: Intevel
- License: mit
- Created: 2023-07-09T15:45:33.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-09T15:46:45.000Z (over 1 year ago)
- Last Synced: 2024-11-04T22:41:59.241Z (about 2 months ago)
- Topics: date, date-format, dtg, format, javascript, nato
- Language: TypeScript
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# dtg-format
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![License][license-src]][license-href]📆 Convert date to DTG
## Install
```sh
# Using npm
npm install dtg-format# Using yarn
yarn add dtg-format
```## Usage
### `toDTG(date: Date, withTimezone?: boolean`
Format a date object to dtg-format.
`withTimezone` is default `false`, if `true` its add the local computer timezone.
```js
// CommonJS
const { toDTG } = require("dtg-format");// ESM
import { toDTG } from "dtg-format";const date = new Date("August 19, 2022 23:15:30 UTC+2");
const dtg = toDTG(date);--> "192315aug22"
```
## License
Published under MIT - Made with ❤️ by Conner Bachmann
[npm-version-src]: https://img.shields.io/npm/v/dtg-format/latest.svg
[npm-version-href]: https://npmjs.com/package/dtg-format
[npm-downloads-src]: https://img.shields.io/npm/dt/dtg-format.svg
[npm-downloads-href]: https://npmjs.com/package/dtg-format
[github-actions-ci-src]: https://github.com/intevel/dtg-format/actions/workflows/ci.yml/badge.svg
[github-actions-ci-href]: https://github.com/intevel/dtg-format/actions?query=workflow%3Aci
[license-src]: https://img.shields.io/npm/l/dtg-format.svg
[license-href]: https://npmjs.com/package/dtg-format