1.0.4 • Published 7 months ago

@romanenko.pavlo/simple-timestamp v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

Simple Timestamp

Introduction

The Simple Timestamp library provides a set of functions and a custom component for formatting and displaying timestamps in various formats. It allows you to easily display date in relative, time, and short formats.

Installation

You can install the Simple Timestamp library via npm:

npm install @romanenko.pavlo/simple-timestamp

Components

SimpleTimestamp Component

The SimpleTimestamp component is a custom LitElement component for displaying formatted timestamps.

Attributes

  • value: String - ISO 8601 timestamp value to be displayed.
  • locale: String - The locale for formatting. Default is the user's browser locale.
  • timezone: String - The timezone to use for formatting. Default is the user's browser timezone.
  • label: String - A label to display before the timestamp.

Functions

formatTime(value: Date, locale: string, timezone: string): string

Formats a given date into a time format (e.g., '3:30 PM').

Parameters

  • value: Date - The date to format.
  • locale: String - The locale for formatting.
  • timezone: String - The timezone to use for formatting.

formatShortDate(value: Date, locale: string, timezone: string): string

Formats a given date into a short date format (e.g., 'Mar 29, 21').

Parameters

  • value: Date - The date to format.
  • locale: String - The locale for formatting.
  • timezone: String - The timezone to use for formatting.

formatRelativeDate(value: Date, locale: string): string

Formats a given date into a relative date format (e.g., '2 days ago').

Parameters

  • value: Date - The date to format.
  • locale: String - The locale for formatting.

Authors

RomanenkoStud

1.0.4

7 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago