Skip to content

Instantly share code, notes, and snippets.

@uyab
Created November 2, 2021 22:50
Show Gist options
  • Save uyab/40546b2581e0e312a4352177d2934d10 to your computer and use it in GitHub Desktop.
Save uyab/40546b2581e0e312a4352177d2934d10 to your computer and use it in GitHub Desktop.
Bug Tanggal Tua
<?php
use Carbon\Carbon;
// Menggenerate array of months: Januari, Februari, Maret, dst
$months = [];
foreach (range(1, 12) as $monthIndex) {
$months[$monthIndex] = Carbon::createFromFormat('m', $monthIndex)->translatedFormat('F');
}
@ghostvar
Copy link

solusi tanggal tua sebenarnya

$months = ["Januari", "Februari", "Maret", "..."];

pusing ah,, tanggal tua ada bug 😂

@uyab
Copy link
Author

uyab commented Jan 20, 2022

@ghostvar yup, terkadang kode yang sederhana bisa lebih robust dan mudah dipahami :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment