An npm package that can easily retrieve time, day, date and other data according to the timezone you specify
Install with npm
npm install timelocation
or connect with CDN
https://www.unpkg.com/timelocation@latest/timelocation.js
With require
const timelocation = require('timelocation')
Connect with CDN
<script src="https://www.unpkg.com/timelocation@latest/timelocation.js"></script>
First of all, you have to define the timezone first
const test1 = timelocation.setArea("Asia/Jakarta", 24, "en-US")
//if you use getGmt then the timezone will follow with your gmt
const test2 = timelocation.setGmt("GMT+7", 12, "en-US")
//if you use getLocal then the timezone will follow your device
const test3 = timelocation.setLocal(24, "en-US")
When defining a timezone, use one of these methods
Each requires parameters
First parameter: (location), does not apply to getLocal
Second parameter: (time format), you can choose the time format 12 hours or 24 hours
Last parameter: (language), you must enter the language to organize the day
test1.getDay() //return: Sun
//use getFullDay to return full day
test1.getFullDay() //return: Sunday
test1.getDate() //return: 7
test1.getMonth() //return: 1
test1.getYear() //return: 24
//use getFullYear to return full year
test1.getFullYear() //return: 2024
test1.getSeconds() //return: 10
test1.getMinutes() //return: 26
test1.getHours() //return: 4
//use getFullHours to add the number 0 when it is below 10, for example 04
test1.getFullHours() //return: 04
test1.getPmAm() //Use this if the time format is 12 hours to display PM or AM