# @polywrap/datetime-plugin-js

> Polywrap Datetime Plugin

Latest version **0.12.0** (published 2023-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @polywrap/datetime-plugin-js
pnpm add @polywrap/datetime-plugin-js
yarn add @polywrap/datetime-plugin-js
bun add @polywrap/datetime-plugin-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.0 |
| Published | 2023-08-20 |
| First published | 2023-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | polywrap-build-bot, dorgjelli |

## Links

- npm: https://www.npmjs.com/package/@polywrap/datetime-plugin-js
- Repository: https://github.com/polywrap/datetime
- npm.io page: https://npm.io/package/@polywrap/datetime-plugin-js

## Dependencies (2)

- [@polywrap/core-js](https://npm.io/package/@polywrap/core-js.md) ~0.12.0
- [@polywrap/plugin-js](https://npm.io/package/@polywrap/plugin-js.md) ~0.12.0

## Recent versions

- 0.12.0 (latest) — 2023-08-20
- 0.12.0-pre.0 (pre) — 2023-07-26
- 0.10.1 — 2023-06-17
- 1.0.0-pre.1 — 2023-03-07
- 1.0.0-pre.0 — 2023-03-02

## README

# @polywrap/datetime-plugin-js
The Datetime plugin implements the `datetime-interface` @ [wrapscan.io/polywrap/datetime@1.0](../../interface/) (see [./polywrap.graphql](./polywrap.graphql)). It provides access to the current unix timestamp of the host operating system.

## Usage
### 1. Configure Client
When creating your Polywrap JS client, add the datetime plugin:
```typescript
import { ClientConfigBuilder } from "@polywrap/client-config-builder-js";
import { PolywrapClient } from "@polywrap/client-js";
import { datetimePlugin } from "@polywrap/datetime-plugin-js";

const config = new ClientConfigBuilder()
  // 1. Add the plugin package @ an arbitrary URI
  .addPackage(
    "plugin/datetime",
    datetimePlugin({ })
  )
  // 2. Register this plugin as an implementation of the interface
  .addInterfaceImplementation(
    "wrapscan.io/polywrap/datetime@1.0",
    "plugin/datetime"
  )
  // 3. Redirect invocations @ the interface to the plugin (default impl)
  .addRedirect(
    "wrapscan.io/polywrap/datetime@1.0",
    "plugin/datetime"
  )
  .build();

const client = new PolywrapClient(config);
```

### 2. Invoke the Datetime Plugin
Invocations to the datetime plugin can be made via the interface URI (which will get redirected), or the plugin's URI directly:
```typescript
await client.invoke({
  uri: "wrapscan.io/polywrap/datetime@1.0" | "plugin/datetime",
  method: "currentTimestamp"
});
```

---
_Source: https://npm.io/package/@polywrap/datetime-plugin-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
