@trndd/time-greeting

2.1.0 • Public • Published

🌤️ Time greeting

npm

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

📜 License

MIT © - Forked from niksudan/time-greeting

Package Sidebar

Install

npm i @trndd/time-greeting

Weekly Downloads

10

Version

2.1.0

License

MIT

Unpacked Size

3.23 kB

Total Files

6

Last publish

Collaborators

  • trndd