Skip to main content

Built and signed on GitHub Actions

This library provides a date string parser for use with the Temporal API.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
4 months ago (0.0.5)
function parse
parse(
input: string,
format: string,
): ParseResult

parsing datetime string.

import { parse } from "@ayame113/temporarily";

const parsed = parse("2024-05-03 15:25:29", "%Y-%m-%d %H:%M:%S");
console.log(parsed); // { year: 2024, month: 5, day: 3, hour: 15, minute: 25, second: 29 }

const date = Temporal.PlainDateTime.from(parsed);
console.log(date); // Temporal { 2024-05-03T15:25:29 }

Parameters

input: string

string you want to parse

format: string

format of string

Return Type

ParseResult

parsed result

Add Package

deno add @ayame113/temporarily

Import symbol

import { parse } from "@ayame113/temporarily";

Add Package

npx jsr add @ayame113/temporarily

Import symbol

import { parse } from "@ayame113/temporarily";

Add Package

yarn dlx jsr add @ayame113/temporarily

Import symbol

import { parse } from "@ayame113/temporarily";

Add Package

pnpm dlx jsr add @ayame113/temporarily

Import symbol

import { parse } from "@ayame113/temporarily";

Add Package

bunx jsr add @ayame113/temporarily

Import symbol

import { parse } from "@ayame113/temporarily";