rwa-time
Get current date in Kinyarwanda (rw) or format other dates to Kinyarwanda (rw).
Table of content
- Installation
- Rwa-Time Date Functions
- getDay(date)
- getMonth(date)
- getMonthNumber(date)
- getYear(date)
- getWeekdayNumber(date)
- getDate(date)
- getFullDate(date)
- getFullWeekdayDate(date)
- getMonthNumberYear(date)
- getHour(date)
- getMinute(date)
- getFullMinute(date)
- getSecond(date)
- getFullSecond(date)
- getTime(date)
- getHourMinute(date)
- getTime(date)
- getDateTime(date)
- getFullCityDate(date)
- getShortCountryDate(date)
- Current Locale Functions
- getCity()
- getRegion()
- getCountry()
- getShortCountry()
- getTimezone()
- License
Installation
via npm:
npm i -S rwa-time
via yarn:
yarn add rwa-time
Scripts
view all available functions:
yarn all
npm run all
Usage
const RwaTime = ;const date = ; console; // 01, Ukuboza 2019
Date Functions
All functions below receive an optional date as a parameter. If no date is passed the function uses the current date.
- {string} date - accepts various formats (optional)
e.g.:
date // => 07/05/2019 Saa Mbiri n'iminota 54 n'amasegonda 32 date // => Saa Mbiri n'iminota 54 n'amasegonda 32 date // => 15/10/1996 date // => Kuwa Gatanu, Taliki ya 08 z'ukwa Cyenda 2017 date // => 10 date // => 24/07/2015 Saa Sita n'iminota 00 n'amasegonda 00 date // => 4 date // => Kuwa Gatatu date
If the date passed is invalid, functions will return 'Invalid Date'.
getDay(date)
- returns day (01 a 31)
let dt = date; // => 01
getMonthNumber(date)
- returns month number (01 a 12)
let dt = date; // => 10
getMonth(date)
let dt = date; // => Ukuboza
number | month |
---|---|
01 | Mutarama |
02 | Gashyantare |
03 | Werurwe |
04 | Mata |
05 | Gicurasi |
06 | Kamena |
07 | Nyakanga |
08 | Kanama |
09 | Nzeri |
10 | Ukwakira |
11 | Ugushyingo |
12 | Ukuboza |
getYear(date)
let dt = date; // => 2019
getWeekdayNumber(date)
- returns the number of the week (1 a 7)
let dt = date; // => 1
getWeekday(date)
let dt = date; // => Ku Cyumweru
number | weekday |
---|---|
1 | Ku Cyumweru |
2 | Kuwa Mbere |
3 | Kuwa Kabiri |
4 | Kuwa Gatatu |
5 | Kuwa Kane |
6 | Kuwa Gatanu |
7 | Kuwa Gatandatu |
getDate(date)
let dt = date; // => 01/12/2019
getFullDate(date)
let dt = date; // => 01, Ukuboza 2019
getFullWeekdayDate(date)
let dt = date; // => Ku Cyumweru, Taliki ya 01 z'ukwa Cumi Na Kabiri 2019
getMonthNumberYear(date)
let dt = date; // => 12/2019
getMonthYear(date)
let dt = date; // => Ukuboza/2019
getHour(date)
- return hours (01 a 23)
let dt = date; // => Saa Munani
getTime(date)
let dt = date; // => Saa Munani n'iminota 48 n'amasegonda 00
getMinute(date)
- return minutes (01 a 59)
let dt = date; // => 48
getFullMinute(date)
let dt = date; // => iminota 48
getSecond(date)
- returns seconds (01 a 59)
let dt = date; // => 00
getFullSecond(date)
let dt = date; // => amasegonda 00
getHourMinute(date)
let dt = date; // => Saa Munani n'iminota 48
getDateTime(date)
let dt = date; // => 24/07/2015 Saa Sita n'iminota 00 n'amasegonda 00
getFullCityDate(date)
asynchronous function
let cty = await date; // => Kigali, 01 Ukuboza, 2019
getFullShortCountryDate(date)
asynchronous function
let dt = await date; // => RW, 01 Ukuboza 2019
Current Locale Functions
All functions bellow are asynchronous and returns current locale informations.
getCity()
asynchronous function
let dt = await date; // => Kigali
getRegion()
asynchronous function
let dt = await date; // => Kigali
getCountry()
asynchronous function
let dt = await date; // => Rwanda
getShortCountry()
asynchronous function
let dt = await date; // => RW
getTimezone()
asynchronous function
let dt = await date; // => Africa/Kigali
License
MIT License
Copyright (c) 2019 Igwaneza Bruce
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.