All Projects → joseluisq → timelite

joseluisq / timelite

Licence: MIT license
String date and time utilities 🕙

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to timelite

Gostradamus
Gostradamus: Better DateTimes for Go 🕰️
Stars: ✭ 148 (+770.59%)
Mutual labels:  time, date, format
Date Fns Tz
Complementary library for date-fns v2 adding IANA time zone support
Stars: ✭ 385 (+2164.71%)
Mutual labels:  time, utilities, date
vue-translated
Internationalization (i18n) and localization (l10n) library for Vue.js v2.
Stars: ✭ 19 (+11.76%)
Mutual labels:  time, date, format
Date Fns
⏳ Modern JavaScript date utility library ⌛️
Stars: ✭ 27,650 (+162547.06%)
Mutual labels:  time, utilities, date
Date And Time
A Minimalist DateTime utility for Node.js and the browser
Stars: ✭ 99 (+482.35%)
Mutual labels:  time, date, format
jodaTime
Format and Parse date and time with joda layout
Stars: ✭ 67 (+294.12%)
Mutual labels:  time, date, format
date-php
这是一个Javascript模仿PHP日期时间格式化函数,使用方法和PHP非常类似,有丰富的模板字符,并在原来的基础上增加了一些模板字符。 This is a date function that implement PHP in Javascript. It is very similar to PHP, has rich template characters, and enhances some template characters on the basis of the original.
Stars: ✭ 24 (+41.18%)
Mutual labels:  time, date, format
Translatedjs
Internationalization and localization for JavaScript and Node.js
Stars: ✭ 17 (+0%)
Mutual labels:  time, date, format
Tinydate
A tiny (349B) reusable date formatter. Extremely fast!
Stars: ✭ 990 (+5723.53%)
Mutual labels:  time, date, format
Time Stamp
Get a formatted timestamp. Used in gulp, assemble, generate, and many others.
Stars: ✭ 104 (+511.76%)
Mutual labels:  time, date, format
lit-date
Light-weight, faster datetime formatter for modern browsers.
Stars: ✭ 33 (+94.12%)
Mutual labels:  time, date, format
Time
Building a better date/time library for Swift
Stars: ✭ 1,983 (+11564.71%)
Mutual labels:  time, date
date-extractor
Extract dates from text
Stars: ✭ 58 (+241.18%)
Mutual labels:  time, date
Date Picker
📅 Custom responsive date picker widget for Android, written in Kotlin.
Stars: ✭ 146 (+758.82%)
Mutual labels:  time, date
Date
A date and time library based on the C++11/14/17 <chrono> header
Stars: ✭ 2,389 (+13952.94%)
Mutual labels:  time, date
Brpickerview
BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
Stars: ✭ 2,149 (+12541.18%)
Mutual labels:  time, date
Dpicker
A framework-agnostic minimal date picker
Stars: ✭ 187 (+1000%)
Mutual labels:  time, date
Sonataintlbundle
Symfony SonataIntlBundle
Stars: ✭ 212 (+1147.06%)
Mutual labels:  time, date
Jiffy
Jiffy is a Flutter (Android, IOS and Web) date time package inspired by momentjs for parsing, manipulating, querying and formatting dates
Stars: ✭ 238 (+1300%)
Mutual labels:  time, date
Delorean
Delorean: Time Travel Made Easy
Stars: ✭ 1,793 (+10447.06%)
Mutual labels:  time, date

Timelite Build Status npm npm JavaScript Style Guide

String date and time utilities. 🕙

Overview

Timelite works in the top of Datetime Strings (ISO 8601), receiving one array of string datetimes and returning one array of Unsigned Datetime Integers. This makes it a portable, compact and faster library if you are probably thinking about why not around Date.

API

For now, the API is quite limited but feel free to contribute.

Time

  • add : Add an array of string times. E.g. add(['04:20:10', '21:15:10']) => [ 25, 35, 2 ]
  • str : Format an array of time values into string time. E.g. str([12, 10, 45]) => 12:10:45
  • sub : Subtract an array of string times. E.g. sub(['20:40:10', '20:10:50']) => [ 0, 29, 20 ]

Date

  • normalize : Normalize string date values returning a valid date as an unsigned integer array. E.g. normalize('0-02-31') => [ 2000, 2, 28 ]
  • str : Format an array date values into a valid string date. E.g. str([0, 0, 0]) => '2000-01-01'

Install

Yarn

yarn add timelite

NPM

npm install timelite

UMD file is also available on unpkg:

<script src="https://unpkg.com/timelite/timelite.umd.min.js"></script>

You can use the library via window.timelite.

Usage

Time

add

Add an array of string time values "HH:mm:ss".

import { add } from 'timelite/time'

add(['04:20:10', '21:15:10'])
// [ 25, 35, 2 ]
add(['04:35:10', '21:35:10'])
// [ 26, 10, 2 ]
add(['30:59', '17:10'])
// [ 48, 09, 0 ]
add(['19:30:00', '00:30:00'])
// [ 20, 00, 0 ]

sub

Subtract an array of string time values "HH:mm:ss".

import { sub } from 'timelite/time'

sub(['20:40:10', '20:10:50'])
// [ 0, 29, 20 ]
sub(['20:05:10', '10:10:50'])
// [ 9, 54, 20 ]

str

Format an array time values into string time.

import { str } from 'timelite/time'

str([12, 10, 45])
// "12:10:45"
str([5, 1, 0])
// "05:01:00"
str([7, 22])
// "07:22:00"

Date

normalize

Normalize string date values returning a valid date as an unsigned integer array.

import { normalize } from 'timelite/date'

normalize('1980-09-02')
// [ 1980, 9, 2 ]
normalize('17')
// [ 2017, 1, 1 ]
normalize('18-04')
// [ 2018, 4, 1 ]
normalize('0-02-31')
// [ 2000, 2, 28 ]

str

Format an array date values into a valid string date.

import { str } from 'timelite/date'

str([ 0, 0, 0 ])
// 2000-01-01
str([ 17, 14, 5 ])
// 2017-12-05
str([ 1988, 2 ])
// 1988-02-01

Contributions

Feel free to send some Pull request or issue.

License

MIT license

© 2018-present Jose Quintana

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].