npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

parse-times

v1.6.0

Published

Simple parsing times and get complete times

Downloads

6

Readme

Parse Times

Parsing waktu dan dapatkan result yang komplit!

Menggunakan library dari MomentJs.

List of Function :

  • getTime() // get => waktu saat ini => Objcet
  • getWeton() // get => weton berdasarkan waktu => String
  • getTimeById() // get => waktu berdasarkan id => Objcet
  • getRelative() // get => Realtive waktu => String
  • getCalendar() // get => Calendar waktu => String

Installation

Install with npm:

$ npm install parse-times

With require:

const parseTimes = require("parse-times");

Usage

Example :

see example.js for details.

Set Locale Time

if you want to change the region, you must read the documentation MomentJs.

parseTimes.set('id') // Default => "id"

Get default Time

const getTime = parseTimes.getTime() // Time Result => Object
const getTimeFormat = parseTimes.getTime({format: "DD/MM/YYYY hh:mm:ss a"}) // => 13/11/2022 19:50:18 malam

const timeId = new Date().getTime() || 1668343818991 // Get Time ID
const getTimeById = parseTimes.getTimeById(timeId) // Use Time ID && Time Result => Object
const getTimeByIdFormat = parseTimes.getTimeById(timeId, {format: "DD/MM/YYYY hh:mm:ss a"}) // => 13/11/2022 19:50:18 malam

/* 
Time Result :
{
  millisecond: 991,
  second: 18,
  minute: 50,
  hour: 19,
  date: 13,
  day: 0,
  dayed: 'Min',
  days: 'Minggu',
  month: 11,
  monthy: 'Nov',
  months: 'November',
  year: 22,
  years: 2022,
  situasion: 'malam',
  full: {
    ll: '13 Nov 2022',
    LL: '13 November 2022',
    lll: '13 Nov 2022 pukul 19.50',
    LLL: '13 November 2022 pukul 19.50',
    llll: 'Min, 13 Nov 2022 pukul 19.50',
    LLLL: 'Minggu, 13 November 2022 pukul 19.50'
  },
  region: { code: 'id', name: 'Indonesia', flag: '🇮🇩' },
  timeId: 1668343818991
}
*/

Get Weton

const getWeton = parseTimes.getWeton(17, 11, 2022) // Date, Month, Year (required)
// => Pahing

Get Relative Time

const timeId = new Date().getTime() || 1668343818991 // Get Time ID

const getRelativeById = parseTimes.getRelative(timeId) // => 14 menit yang lalu
const getRelativeBySeconds = parseTimes.getRelative(timeId, {input: 10, based: 'seconds'}) // => dalam beberapa detik
const getRelativeMinutes = parseTimes.getRelative(timeId, {input: 10, based: 'minutes'}) // => dalam 10 menit
const getRelativeHours = parseTimes.getRelative(timeId, {input: 10, based: 'hours'}) // => dalam 10 jam
const getRelativeDays = parseTimes.getRelative(timeId, {input: 10, based: 'days'}) // => dalam 10 hari
const getRelativeMonths = parseTimes.getRelative(timeId, {input: 10, based: 'months'}) // => dalam 10 bulan
const getRelativeYears = parseTimes.getRelative(timeId, {input: 10, based: 'years'}) // => dalam 10 tahun

Get Calendar Time

const timeId = new Date().getTime() || 1668343818991 // Get Time ID

const getCalendarById = parseTimes.getCalendar(timeId) // => Hari ini pukul 19.50
const getCalendarBySeconds = parseTimes.getCalendar(timeId, {input: 10, based: 'seconds'}) // => Hari ini pukul 20.09
const getCalendarMinutes = parseTimes.getCalendar(timeId, {input: 10, based: 'minutes'}) // => Hari ini pukul 20.19
const getCalendarHours = parseTimes.getCalendar(timeId, {input: 10, based: 'hours'}) // => Besok pukul 06.09
const getCalendarDays = parseTimes.getCalendar(timeId, {input: 10, based: 'days'}) // => 23/11/2022
const getCalendarMonths = parseTimes.getCalendar(timeId, {input: 10, based: 'months'}) // => 13/09/2023
const getCalendarYears = parseTimes.getCalendar(timeId, {input: 10, based: 'years'}) // => 13/11/2032

Testing

Install dependencies:

npm install

Run tests:

npm run test

License

Code released under the Apache license.