All Projects → masbagal → Tempe

masbagal / Tempe

Licence: mit
Featherlight (< 2kB) helper for Javascript date formatting

Programming Languages

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

Labels

Projects that are alternatives of or similar to Tempe

vue-translated
Internationalization (i18n) and localization (l10n) library for Vue.js v2.
Stars: ✭ 19 (-76.25%)
Mutual labels:  i18n, date
Translatedjs
Internationalization and localization for JavaScript and Node.js
Stars: ✭ 17 (-78.75%)
Mutual labels:  i18n, date
Moment.php
Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Stars: ✭ 900 (+1025%)
Mutual labels:  i18n, date
Locale2
💪 Try as hard as possible to detect the client's language tag ("locale") in node or the browser. Browserify and Webpack friendly!
Stars: ✭ 65 (-18.75%)
Mutual labels:  i18n
Ifme
Free, open source mental health communication web app to share experiences with loved ones
Stars: ✭ 1,147 (+1333.75%)
Mutual labels:  i18n
Gp Vue Boilerplate
Grabarz & Partner Boilerplate is a professional front-end template for building fast, robust, and adaptable web apps or sites with vuejs.
Stars: ✭ 71 (-11.25%)
Mutual labels:  i18n
Yymmdd
Tiny DSL for idiomatic date parsing and formatting in Ruby
Stars: ✭ 77 (-3.75%)
Mutual labels:  date
Redux React I18n
An i18n solution for React/Redux and React Native projects
Stars: ✭ 64 (-20%)
Mutual labels:  i18n
Carbon
A simple PHP API extension for DateTime
Stars: ✭ 75 (-6.25%)
Mutual labels:  date
Iso8601
Ruby parser to work with ISO8601 dateTimes and durations — http://en.wikipedia.org/wiki/ISO_8601
Stars: ✭ 70 (-12.5%)
Mutual labels:  date
Translala
Translation Toolbox for your Laravel/Symfony project (translate, stats, commons and dead translations reports, coverage, CI process)
Stars: ✭ 70 (-12.5%)
Mutual labels:  i18n
I18n plural
I18n module for grammatically correct plural inflections, and maybe even some extra features related to i18n.
Stars: ✭ 68 (-15%)
Mutual labels:  i18n
Android Pickerdialog
一个兼容手机和电视(焦点选择)的高仿IOS风格的选择器
Stars: ✭ 72 (-10%)
Mutual labels:  date
Gettext Go
🆎 GNU gettext for Go (Imported By Kubernetes)
Stars: ✭ 66 (-17.5%)
Mutual labels:  i18n
Risingstars2016
A complete overview of the JavaScript landscape in 2016: trends about front-end and node.js frameworks, tooling... Available in English, Japanese and Chinese.
Stars: ✭ 75 (-6.25%)
Mutual labels:  i18n
Laravel Lang
🌏 75 languages support for Laravel application.
Stars: ✭ 1,134 (+1317.5%)
Mutual labels:  i18n
Developmint.de
Open source company page built with Nuxt.js and TailwindCSS
Stars: ✭ 74 (-7.5%)
Mutual labels:  i18n
Elm I18n
Localization for Elm apps as a pre-build phase with import and export between elm code and CSV/PO
Stars: ✭ 68 (-15%)
Mutual labels:  i18n
Angular I18next
angular v2.0+ integration with i18next v8.4+
Stars: ✭ 69 (-13.75%)
Mutual labels:  i18n
Dategrid
A customizable swiftui calendar
Stars: ✭ 71 (-11.25%)
Mutual labels:  date
Tempe Logo

Featherlight (2kB) helper for Javascript date formatting

min min

Sometimes all you need is just a simple date formatting without all of those super powers.

Name is a play from tempus, Latin word meaning time and tempe an Indonesian traditional food.

📦 Install

$ yarn add tempe

 or

$ npm install tempe --save

💻 Usage

Use the default export, pass existing date object or you can initialize it like normal Javascript Date object.

import tempe from 'tempe';

// use tempe as Date initializer
tempe(2020, 0, 13).format('dd, DD MMM YYYY'); // "Monday, 13 Jan 2020"

// pass existing Date object to tempe
tempe(new Date(2020, 0, 13)).format('dd, DD MMM YYYY'); // "Monday, 13 Jan 2020"

// time formatting
tempe(2020, 2, 25, 23, 59).format('DD MMMM YYYY hh:mm:ss'); // "25 March 2020 23:59:00"
tempe(2020, 2, 25, 23, 59).format('H at DD/MM/YYYY'); // "11 PM at 25/03/2020"

🌐 i18n

Tempe supports internationalization by specifying the locale while formatting

import tempe from 'tempe';

tempe(2020, 5, 13).format('DD MMM YYYY', 'ja'); // "13日 6月 2020年"
tempe(2020, 5, 13).format('DD MMM YYYY', 'vi'); // "13 Tháng 6 2020"
tempe(2020, 5, 13).format('DD MMM YYYY', 'id'); // "13 Juni 2020"

Calendar Types

Meanwhile, some locale have their own default calendar type. For example, if you're using a Thailand locale it will generate a Buddhist calendar that show a different year than standard gregorian calendar.

tempe(2020, 5, 13).format('DD MMM YYYY', 'th'); // 13 มิถุนายน พ.ศ. 2563

You can change it by providing the calendar type in the third optional parameter of format() function.

// change calendar type to gregorian
tempe(2020, 5, 13).format('DD MMM YYYY', 'th', 'gregory' ); // 13 มิถุนายน พ.ศ. 2020

// change calendar type to islamic
tempe(2020, 5, 13).format('DD MMM YYYY', 'id', 'islamic' ); // 22 Syawal 1441 H

Possible values for this parameter includes:

  • "buddhist"
  • "chinese"
  • "coptic"
  • "ethiopia"
  • "ethiopic"
  • "gregory"
  • "hebrew"
  • "indian"
  • "islamic"
  • "iso8601"
  • "japanese"
  • "persian"
  • "roc"

This is an optional parameter. By leaving this parameter empty, the date will be generated using the default type of provided locale.

📝 List of all available formats

Format Output Description
YY 18 Two-digit year
YYYY 2018 Four-digit year
M 1-12 The month, beginning at 1
MM 01-12 The month, 2-digits
MMM Jan-Dec The abbreviated month name
MMMM January-December The full month name
D 1-31 The day of the month
DD 01-31 The day of the month, 2-digits
dd Sun-Sat The short name of the day of the week
ddd Sunday-Saturday The name of the day of the week
H 0-23 AM/PM The hour with AM/PM
HH 0-23 AM/PM The hour with AM/PM
h 01-12 The hour, 12-hour clock
hh 01-12 The hour, 12-hour clock
m 0-59 The minute
mm 00-59 The minute, 2-digits
s 0-59 The second
ss 00-59 The second, 2-digits

This project was bootstrapped with TSDX.

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].