0.9.2 • Published 7 months ago

moment-utc-time v0.9.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Moment UTC Time Converter 🕙

A lightweight package addition to momentjs which can parse any time (not date, time only) into utc and opposite from utc to your local time.

🔍 Table of Contents


📦 Installation

Add Moment UTC Time to your project

npm i moment-utc-time

Also make sure you have moment installed in your Package, as our project does not have moment as a depndency.

npm i moment

Checkout moment documentation for more information.

🚀 Features

  • Converts a given local time string to a UTC time string (without date)
  • Converts a given UTC time string to a local time string (without date)

💡 Usage

It converts time (of format HH:mm:ss) into UTC fromat and vice versa without whole date string, so you don't need whole DD:MM:YYYY HH:mm:ss like strings for converting, it's enough just to provide full time string in HH:mm:ss format, e.g. 08:00:00, which will be converted into 04:00:00 for GMT+4 timezone.

import { convertTimeToUtc, convertUtcToTime } from 'moment-utc-time';

const convertedUtcTime = convertTimeToUtc('08:00:00');
console.log(convertedUtcTime); // '04:00:00'

const convertedLocalTime = convertUtcToTime('04:00:00');
console.log(convertedLocalTime); // 08:00:00

🙏 Contributing

Got ideas or found a bug? We appreciate your contributions! Here's how you can get involved:

  • Open an Issue: If you have a new feature idea, want to report a bug, or have a general question, open an issue.
  • Send a Pull Request (PR): Contributions are welcome! If you'd like to contribute code, follow these steps:
    • Fork the repository.
    • Create a new branch for your feature or bug fix.
    • Make your changes and submit a pull request.
  • Spread the Word: If you find this library helpful, consider sharing it with others or giving it a star on GitHub.

📄 License

Licensed under the MIT License.


Made with ❤️ by Albert Arakelyan https://www.albertarakelyan.com

0.9.2

7 months ago

0.9.1

7 months ago

0.9.0

7 months ago