2.1.0 • Published 4 years ago

@trndd/time-greeting v2.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

🌤️ 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' })

LanguageLocale propReturn
PortugueseptBom dia / Boa tarde / Boa noite
SpanishesBuenos días / Buenas tardes / Buenas noches
FrenchfrBonjour / Bon après-midi /Bonne nuit
EnglishdefaultGood morning / Good afternoon / Good evening

Date

useGreeting({ date: '1970-01-01 21:00:00' })

🌍 Locales

  • English
  • Portuguese
  • Spanish
  • French

📜 License

MIT © - Forked from niksudan/time-greeting

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago