Skip to content

formatTime

Category
Last Changed
3月21日16时25分

Automatically update the time ago string when the time changes.

formatter:

  • year: yyyy
  • quarter: q
  • month: MM
  • day: dd
  • hour: hh
  • minute: mm
  • second: ss
  • millisecond: S

Demo

parseTime: 2025-10-29 10:53:13
formatTime: 刚刚
0ms
format:
format:

Usage

js
import { formatTime, parseTime } from 'comuse-shared'

const timeAgo = formatTime(new Date(2024, 12, 1))

parseTime(new Date(), 'yyyy-MM-dd hh:mm:ss')

Source

SourceDemoDocs

Changelog

No recent changes

Released under the MIT License.