An open API service indexing awesome lists of open source software.

https://github.com/jaimeloeuf/datetime-ts

A date time library that just works.
https://github.com/jaimeloeuf/datetime-ts

date datetime iso8601 time timestamp typescript unix unixtimestamp

Last synced: 3 months ago
JSON representation

A date time library that just works.

Awesome Lists containing this project

README

          

# datetime-ts
A date time library that just works.

## Usage
This library lets you use the utility either by importing or running a side effect to set `$DateTime` utility on `globalThis` so that it can be used anywhere in your codebase.

### Use as global value (default)
All global values have the `$` prefix.

```typescript
// In your root entry file
// import module for side effect (makes this available globally)
import "datetime-ts";

// Any file in your codebase without any import
console.log($DateTime.now.asIsoDate())
```

### Use as module import
```typescript
import { DateTime } from "datetime-ts";

console.log(DateTime.now.asIsoDate())
```