A Python package to generate random dates in different formats and languages.
Project description
"""
Generator Dates
Generator Dates is a Python library for generating random dates in various formats and languages.
Supports English (en) and Russian (ru) languages.
Features
- Random date generation with a customizable format
- Support for full and abbreviated month names
- Selection of day, month, and year ranges
- Saving history of generated dates
- Output support as
datetimeanddateobjects - Handling of invalid ranges
Installation
Install via pip:
pip install generator_dates
Or manually:
git clone https://github.com/yourusername/generator_dates.git
cd generator_dates
pip install .
Usage
from generator_dates import GeneratorDates
generator = GeneratorDates(format="{d} {month} {y}", lang="ru", save_history=True)
random_date = generator.generate_date(range_day=(1, 30), range_month=(1, 12), range_year=(1900, 2023))
print(random_date) # Example: 12 марта 1987
# View history of generated dates
print(generator.history)
Settings
format– date format string:{d}– day of the month{m}– month number{y}– year{mon}– abbreviated month name{month}– full month name'datetime'– returns adatetimeobject'date'– returns adateobject
lang– language (enorru)save_history– whether to save the history of generated dates (default isTrue)
Exceptions
LanguageError– if an unsupported language is provided.ValueError– if invalid ranges for day, month, or year are given.
License
This project is licensed under the MIT License. """
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file generator_dates-0.2.5.tar.gz.
File metadata
- Download URL: generator_dates-0.2.5.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d049db53fadbade0a4b61602efab924c8c9124cc17dc2a0880a0bb67c0201881
|
|
| MD5 |
6718731cb8fd0895f8c4a57785b0752c
|
|
| BLAKE2b-256 |
590b0cb5bc7f9d6376238324d1fe576bb2227b68b472792a3cdba55c10351ad1
|
File details
Details for the file generator_dates-0.2.5-py3-none-any.whl.
File metadata
- Download URL: generator_dates-0.2.5-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89ffa55e3c41c462635e4ced257f3596dea2c9dff3c7b715256db39d859f6eb8
|
|
| MD5 |
d623a7178d01c7836302a73a9a7fb26b
|
|
| BLAKE2b-256 |
459882bc3f5c094e1e8f749a597242b5c5c525948a1cef14a8501260a4cbda9c
|