https://github.com/warcooft/codeigniter4-indonesian-date
Indonesian Standard Datetime Output
https://github.com/warcooft/codeigniter4-indonesian-date
codeigniter-library codeigniter4 indonesian-date php8
Last synced: 3 months ago
JSON representation
Indonesian Standard Datetime Output
- Host: GitHub
- URL: https://github.com/warcooft/codeigniter4-indonesian-date
- Owner: warcooft
- License: mit
- Created: 2024-09-06T08:27:59.000Z (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2025-03-10T04:38:21.000Z (10 months ago)
- Last Synced: 2025-10-14T21:36:21.927Z (3 months ago)
- Topics: codeigniter-library, codeigniter4, indonesian-date, php8
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Aselsan\IndonesianDate
Lightweight Indonesian Standard Datetime Output for CodeIgniter 4


# Quick Start
1. Install with Composer
```
composer require aselsan/indonesian-date
```
2. Set up your entity
```php
use Aselsan\IndonesianDate\Traits\IndonesianDateTraits;
use CodeIgniter\Shield\Entities\User as ShieldUserEntity;
class User extends ShieldUserEntity
{
use IndonesianDateTraits;
public function __construct(?array $data = null)
{
parent::__construct($data);
}
```
# Usage
```php
/**
* Default parameters for indonesianDate
* indonesianDate(string $attribute, bool $showDayOfWeek = true, bool $showTime = false)
*/
echo auth()->user()->indonesianDate('created_at');
// Result: "Jum'at, 6 September 2024"
// If you want to hide the day of the week, set the second parameter to false
echo auth()->user()->indonesianDate('created_at', false);
// Result: "6 September 2024"
// If you want to display the time, set the third parameter to true
echo auth()->user()->indonesianDate('created_at', false, true);
// Result: "6 September 2024 18:00"
// Get zodiac sign
echo auth()->user()->zodiac('tanggal_lahir');
// Result: "Aquarius"
// Get age
echo auth()->user()->age('tanggal_lahir');
// Result: 18
```
## License
This project is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details.