@trndd/time-greeting
v2.1.0
Published
Get a greeting based on the time of day
Downloads
76
Maintainers
Readme
🌤️ Time greeting
Get a greeting based on the time of day
🚀 Installation
npm install --save @trndd/time-greeting
or
yarn add @trndd/time-greeting
🦄 Usage
import useGreeting from "@trndd/time-greeting"
useGreeting()
// Return
{
greeting: 'Good morning' || 'Good afternoon' || 'Good evening',
status: 0 || 1 || 2
}
useGreeting({
date: '1970-01-01 21:00:00',
locale: 'pt'
})
// Return
{ greeting: 'Bom dia', status: 0 }
⚙️ Props
Locale
useGreeting({ locale: 'pt' })
| Language | Locale prop | Return | |------------|-------------|----------------------------------------------| | Portuguese | pt | Bom dia / Boa tarde / Boa noite | | Spanish | es | Buenos días / Buenas tardes / Buenas noches | | French | fr | Bonjour / Bon après-midi /Bonne nuit | | English | default | Good morning / Good afternoon / Good evening |
Date
useGreeting({ date: '1970-01-01 21:00:00' })
🌍 Locales
- [x] English
- [x] Portuguese
- [x] Spanish
- [X] French