Simple, Lightweight javascript date parser developed in TypeScript
This repository has been archived on 2024-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Daniel Legt 3c63b9cc5b + Versioning 2022-05-08 10:30:17 +03:00
dist . 2022-05-07 13:54:58 +03:00
src + A lot of distribution Work 2022-05-07 15:04:19 +03:00
.gitignore + A lot of distribution Work 2022-05-07 15:04:19 +03:00
.npmignore + A lot of distribution Work 2022-05-07 15:04:19 +03:00
CONTRIBUTING.md + A lot of distribution Work 2022-05-07 15:04:19 +03:00
README.md + Readme Update 2022-05-08 10:30:07 +03:00
jestconfig.json + A lot of distribution Work 2022-05-07 15:04:19 +03:00
license + License 2022-05-06 00:48:33 +03:00
package-lock.json + A lot of distribution Work 2022-05-07 15:04:19 +03:00
package.json + Versioning 2022-05-08 10:30:17 +03:00
tsconfig.json + A lot of distribution Work 2022-05-07 15:04:19 +03:00

README.md

Tyme.js

Site | Docs/Wiki | Contributing |

Building the project yourself:

$ git pull https://github.com/JustKato/Tyme.js tymejs
$ cd tymejs
$ npm run build

Download

Web Download NPM Download

Tyme.js is released under the MIT license & supports modern environments.

Installation

In a browser:

<script src="tyme.js"></script>

Using npm:

$ npm i tymejs

Usage

All of the available formats are directly from PHP's date formats

⚠ Warning ⚠

⚠ Not all different character formats have been implemented. ⚠

In Node.js TypeScript:

// Import the Package
import TymeJS from "tymejs"; // Use require for plain javascript

// Get the date object from Somewhere
let myDate: Date = new Date();

// Initialize the TymeJS Object
let t: TymeJS = new TymeJS(myDate);

// Now you can format different dates
let formattedDate: string = t.format("d/m/Y H:i A");

// All Available formats: https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-parameters

// Log the formatted Date
console.log(formattedDate);

In Node.js using JavaScript:

const { default: TymeJS } = require("tymejs");

// Get the date object from Somewhere
let myDate = new Date();

// Initialize the TymeJS Object
let t = new TymeJS(myDate);

// Now you can format different dates
let formattedDate = t.format("d/m/Y H:i A");

// All Available formats: https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-parameters

// Log the formatted Date
console.log(formattedDate);

Why TymeJS?

TymeJS makes working with JavaScript date objects much easier, I've found myself
multiple times in the situation where the client doesn't like their region's date format and requests for custom formats, this consumed a lot of time implementing, so that's why I have created this library, for:

  • Reliable Date formats
  • Reliable Time formats
  • TypeScript Support