0.0.19 • Published 4 years ago
@lailao10x/laotime v0.0.19
laotime
Convert date time to lao language format.
ປ່ຽນເວລາເປັນ format ພາສາລາວ.
Installation
# using npm
npm install @lailao10x/laotime
# using yarn
yarn add @lailao10x/laotimeUsage
# using require
const laotime = require('@lailao10x/laotime');
# using import
import laotime from '@lailao10x/laotime';Example
const getLaotime = laotime("2021-08-24 08:01");
console.log(getLaotime); // 24 ສິງຫາ 2021
or;
const getLaotime = laotime("2021-08-24 08:03", "D M Y, H:MN:S");
console.log(getLaotime); // 24 ສິງຫາ 2021, 08:03:00
or;
const getLaotime = laotime("2021-08-24", "D M Y, H:MN:S");
console.log(getLaotime); // 24 ສິງຫາ 2021, 08:03:00
or;
const getLaotime = laotime(new Date(), "D/M/Y, H:MN:S");
console.log(getLaotime); // 24/ສິງຫາ/2021, 08:03:00
or;
const getLaotime = laotime(new Date().getTime(), "D M Y, H:MN:S");
console.log(getLaotime); // 24 ສິງຫາ 2021, 08:03:00
or;
const getLaotime = laotime(new Date(), "W");
console.log(getLaotime); // ພະຫັດ
or;
const getLaotime = laotime();
console.log(getLaotime); // ສະແດງວັນເວລາປະຈຸບັນTokens and meanings are as follows:
| Token | Meaning |
|---|---|
D or date or DATE | Date |
M or month or MONTH | Month |
Y or year or YEAR | Year |
H or hour or HOUR | Hour |
MNor minute or MINUTE | Minute |
S or second or SECOND | Second |
W or week_day or dayor WEEK_DAY | Week day |
Messaegs
ຖ້າຫາກວັນເວລາທີ່ປ້ອນເຂົ້ານັ້ນບໍ່ຖືກຕ້ອງ laotime ຈະສົ່ງຄ່າກັບ Invalid Data