New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pytimeliner

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pytimeliner

Create a timeline by listing events with multilingual support.

  • 0.4.1.3
  • PyPI
  • Socket score

Maintainers
1

PyTimeliner

Issues open Last commit License Latest version PyPI Version

PyTimeliner is a Python package for working with time-based functions such as formatting, time calculations, and multilingual time expressions. This package provides various tools for handling date and time calculations in multiple languages.

Features

  • Format and humanize time expressions
  • Perform date and time calculations
  • Get time expressions in different languages
  • Useful for applications requiring time-based utilities in various languages

Installation

Using setup.py

First, clone the repository and navigate to the project directory. Then, install the package with:

pip install -e .

This package uses googletrans for translation support. If you are using requirements.txt, make sure it contains:

googletrans==4.0.0-rc1

Usage

Using PyTimeliner, you can perform time calculations, format times, and translate time expressions.

Example Usage

from pytimeliner.timeliner import TimeLiner
from datetime import datetime

# English timeline
timeliner = TimeLiner(language='en')
print(timeliner.format_time(datetime.now()))
print(timeliner.time_since(datetime(2023, 1, 1, 12, 0, 0)))
timeliner.set_language('es')
print(timeliner.time_since(datetime(2023, 1, 1, 12, 0, 0)))

Output

2024-10-29 12:34:56
"298 days ago"        # English
"hace 298 días"       # Spanish (translated)

Development

To contribute to this project, please follow the GitHub Repository and create a fork. Make sure you have the following in requirements.txt:

googletrans==4.0.0-rc1

You can install the requirements with:

pip install -r requirements.txt

Running Tests

To run tests, use the tests folder which contains test files:

python -m unittest discover -s tests

Contributing

If you want to contribute, feel free to open an issue or submit a pull request. All contributions are welcome!

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc