repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/ToStringFormat.php | src/Carbon/Traits/ToStringFormat.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\FactoryImmutable;
use Closure;
/**
* Trait ToStringFormat.
*
* Handle global format customization for string cast of the object.
*/
trait ToStringFormat
{
/**
* Reset the format used to the default when type juggling a Carbon instance to a string
*
* @return void
*/
public static function resetToStringFormat(): void
{
FactoryImmutable::getDefaultInstance()->resetToStringFormat();
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and
* use other method or custom format passed to format() method if you need to dump another string
* format.
*
* Set the default format used when type juggling a Carbon instance to a string.
*
* @param string|Closure|null $format
*
* @return void
*/
public static function setToStringFormat(string|Closure|null $format): void
{
FactoryImmutable::getDefaultInstance()->setToStringFormat($format);
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Date.php | src/Carbon/Traits/Date.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use BadMethodCallException;
use Carbon\Carbon;
use Carbon\CarbonInterface;
use Carbon\CarbonPeriod;
use Carbon\CarbonTimeZone;
use Carbon\Exceptions\BadComparisonUnitException;
use Carbon\Exceptions\ImmutableException;
use Carbon\Exceptions\InvalidTimeZoneException;
use Carbon\Exceptions\UnitException;
use Carbon\Exceptions\UnknownGetterException;
use Carbon\Exceptions\UnknownMethodException;
use Carbon\Exceptions\UnknownSetterException;
use Carbon\Exceptions\UnknownUnitException;
use Carbon\FactoryImmutable;
use Carbon\Month;
use Carbon\Translator;
use Carbon\Unit;
use Carbon\WeekDay;
use Closure;
use DateInterval;
use DatePeriod;
use DateTime;
use DateTimeImmutable;
use DateTimeInterface;
use DateTimeZone;
use Generator;
use InvalidArgumentException;
use ReflectionException;
use Symfony\Component\Clock\NativeClock;
use Throwable;
/**
* A simple API extension for DateTime.
*
* <autodoc generated by `composer phpdoc`>
*
* @property string $localeDayOfWeek the day of week in current locale
* @property string $shortLocaleDayOfWeek the abbreviated day of week in current locale
* @property string $localeMonth the month in current locale
* @property string $shortLocaleMonth the abbreviated month in current locale
* @property int $year
* @property int $yearIso
* @property int $month
* @property int $day
* @property int $hour
* @property int $minute
* @property int $second
* @property int $micro
* @property int $microsecond
* @property int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday)
* @property int|float|string $timestamp seconds since the Unix Epoch
* @property string $englishDayOfWeek the day of week in English
* @property string $shortEnglishDayOfWeek the abbreviated day of week in English
* @property string $englishMonth the month in English
* @property string $shortEnglishMonth the abbreviated month in English
* @property int $milliseconds
* @property int $millisecond
* @property int $milli
* @property int $week 1 through 53
* @property int $isoWeek 1 through 53
* @property int $weekYear year according to week format
* @property int $isoWeekYear year according to ISO week format
* @property int $age does a diffInYears() with default parameters
* @property int $offset the timezone offset in seconds from UTC
* @property int $offsetMinutes the timezone offset in minutes from UTC
* @property int $offsetHours the timezone offset in hours from UTC
* @property CarbonTimeZone $timezone the current timezone
* @property CarbonTimeZone $tz alias of $timezone
* @property int $centuryOfMillennium The value of the century starting from the beginning of the current millennium
* @property int $dayOfCentury The value of the day starting from the beginning of the current century
* @property int $dayOfDecade The value of the day starting from the beginning of the current decade
* @property int $dayOfMillennium The value of the day starting from the beginning of the current millennium
* @property int $dayOfMonth The value of the day starting from the beginning of the current month
* @property int $dayOfQuarter The value of the day starting from the beginning of the current quarter
* @property int $dayOfWeek 0 (for Sunday) through 6 (for Saturday)
* @property int $dayOfYear 1 through 366
* @property int $decadeOfCentury The value of the decade starting from the beginning of the current century
* @property int $decadeOfMillennium The value of the decade starting from the beginning of the current millennium
* @property int $hourOfCentury The value of the hour starting from the beginning of the current century
* @property int $hourOfDay The value of the hour starting from the beginning of the current day
* @property int $hourOfDecade The value of the hour starting from the beginning of the current decade
* @property int $hourOfMillennium The value of the hour starting from the beginning of the current millennium
* @property int $hourOfMonth The value of the hour starting from the beginning of the current month
* @property int $hourOfQuarter The value of the hour starting from the beginning of the current quarter
* @property int $hourOfWeek The value of the hour starting from the beginning of the current week
* @property int $hourOfYear The value of the hour starting from the beginning of the current year
* @property int $microsecondOfCentury The value of the microsecond starting from the beginning of the current century
* @property int $microsecondOfDay The value of the microsecond starting from the beginning of the current day
* @property int $microsecondOfDecade The value of the microsecond starting from the beginning of the current decade
* @property int $microsecondOfHour The value of the microsecond starting from the beginning of the current hour
* @property int $microsecondOfMillennium The value of the microsecond starting from the beginning of the current millennium
* @property int $microsecondOfMillisecond The value of the microsecond starting from the beginning of the current millisecond
* @property int $microsecondOfMinute The value of the microsecond starting from the beginning of the current minute
* @property int $microsecondOfMonth The value of the microsecond starting from the beginning of the current month
* @property int $microsecondOfQuarter The value of the microsecond starting from the beginning of the current quarter
* @property int $microsecondOfSecond The value of the microsecond starting from the beginning of the current second
* @property int $microsecondOfWeek The value of the microsecond starting from the beginning of the current week
* @property int $microsecondOfYear The value of the microsecond starting from the beginning of the current year
* @property int $millisecondOfCentury The value of the millisecond starting from the beginning of the current century
* @property int $millisecondOfDay The value of the millisecond starting from the beginning of the current day
* @property int $millisecondOfDecade The value of the millisecond starting from the beginning of the current decade
* @property int $millisecondOfHour The value of the millisecond starting from the beginning of the current hour
* @property int $millisecondOfMillennium The value of the millisecond starting from the beginning of the current millennium
* @property int $millisecondOfMinute The value of the millisecond starting from the beginning of the current minute
* @property int $millisecondOfMonth The value of the millisecond starting from the beginning of the current month
* @property int $millisecondOfQuarter The value of the millisecond starting from the beginning of the current quarter
* @property int $millisecondOfSecond The value of the millisecond starting from the beginning of the current second
* @property int $millisecondOfWeek The value of the millisecond starting from the beginning of the current week
* @property int $millisecondOfYear The value of the millisecond starting from the beginning of the current year
* @property int $minuteOfCentury The value of the minute starting from the beginning of the current century
* @property int $minuteOfDay The value of the minute starting from the beginning of the current day
* @property int $minuteOfDecade The value of the minute starting from the beginning of the current decade
* @property int $minuteOfHour The value of the minute starting from the beginning of the current hour
* @property int $minuteOfMillennium The value of the minute starting from the beginning of the current millennium
* @property int $minuteOfMonth The value of the minute starting from the beginning of the current month
* @property int $minuteOfQuarter The value of the minute starting from the beginning of the current quarter
* @property int $minuteOfWeek The value of the minute starting from the beginning of the current week
* @property int $minuteOfYear The value of the minute starting from the beginning of the current year
* @property int $monthOfCentury The value of the month starting from the beginning of the current century
* @property int $monthOfDecade The value of the month starting from the beginning of the current decade
* @property int $monthOfMillennium The value of the month starting from the beginning of the current millennium
* @property int $monthOfQuarter The value of the month starting from the beginning of the current quarter
* @property int $monthOfYear The value of the month starting from the beginning of the current year
* @property int $quarterOfCentury The value of the quarter starting from the beginning of the current century
* @property int $quarterOfDecade The value of the quarter starting from the beginning of the current decade
* @property int $quarterOfMillennium The value of the quarter starting from the beginning of the current millennium
* @property int $quarterOfYear The value of the quarter starting from the beginning of the current year
* @property int $secondOfCentury The value of the second starting from the beginning of the current century
* @property int $secondOfDay The value of the second starting from the beginning of the current day
* @property int $secondOfDecade The value of the second starting from the beginning of the current decade
* @property int $secondOfHour The value of the second starting from the beginning of the current hour
* @property int $secondOfMillennium The value of the second starting from the beginning of the current millennium
* @property int $secondOfMinute The value of the second starting from the beginning of the current minute
* @property int $secondOfMonth The value of the second starting from the beginning of the current month
* @property int $secondOfQuarter The value of the second starting from the beginning of the current quarter
* @property int $secondOfWeek The value of the second starting from the beginning of the current week
* @property int $secondOfYear The value of the second starting from the beginning of the current year
* @property int $weekOfCentury The value of the week starting from the beginning of the current century
* @property int $weekOfDecade The value of the week starting from the beginning of the current decade
* @property int $weekOfMillennium The value of the week starting from the beginning of the current millennium
* @property int $weekOfMonth 1 through 5
* @property int $weekOfQuarter The value of the week starting from the beginning of the current quarter
* @property int $weekOfYear ISO-8601 week number of year, weeks starting on Monday
* @property int $yearOfCentury The value of the year starting from the beginning of the current century
* @property int $yearOfDecade The value of the year starting from the beginning of the current decade
* @property int $yearOfMillennium The value of the year starting from the beginning of the current millennium
* @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark)
* @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark)
* @property-read string $timezoneAbbreviatedName the current timezone abbreviated name
* @property-read string $tzAbbrName alias of $timezoneAbbreviatedName
* @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language
* @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language
* @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language
* @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language
* @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language
* @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language
* @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language
* @property-read int $noZeroHour current hour from 1 to 24
* @property-read int $isoWeeksInYear 51 through 53
* @property-read int $weekNumberInMonth 1 through 5
* @property-read int $firstWeekDay 0 through 6
* @property-read int $lastWeekDay 0 through 6
* @property-read int $quarter the quarter of this instance, 1 - 4
* @property-read int $decade the decade of this instance
* @property-read int $century the century of this instance
* @property-read int $millennium the millennium of this instance
* @property-read bool $dst daylight savings time indicator, true if DST, false otherwise
* @property-read bool $local checks if the timezone is local, true if local, false otherwise
* @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise
* @property-read string $timezoneName the current timezone name
* @property-read string $tzName alias of $timezoneName
* @property-read string $locale locale of the current instance
* @property-read int $centuriesInMillennium The number of centuries contained in the current millennium
* @property-read int $daysInCentury The number of days contained in the current century
* @property-read int $daysInDecade The number of days contained in the current decade
* @property-read int $daysInMillennium The number of days contained in the current millennium
* @property-read int $daysInMonth number of days in the given month
* @property-read int $daysInQuarter The number of days contained in the current quarter
* @property-read int $daysInWeek The number of days contained in the current week
* @property-read int $daysInYear 365 or 366
* @property-read int $decadesInCentury The number of decades contained in the current century
* @property-read int $decadesInMillennium The number of decades contained in the current millennium
* @property-read int $hoursInCentury The number of hours contained in the current century
* @property-read int $hoursInDay The number of hours contained in the current day
* @property-read int $hoursInDecade The number of hours contained in the current decade
* @property-read int $hoursInMillennium The number of hours contained in the current millennium
* @property-read int $hoursInMonth The number of hours contained in the current month
* @property-read int $hoursInQuarter The number of hours contained in the current quarter
* @property-read int $hoursInWeek The number of hours contained in the current week
* @property-read int $hoursInYear The number of hours contained in the current year
* @property-read int $microsecondsInCentury The number of microseconds contained in the current century
* @property-read int $microsecondsInDay The number of microseconds contained in the current day
* @property-read int $microsecondsInDecade The number of microseconds contained in the current decade
* @property-read int $microsecondsInHour The number of microseconds contained in the current hour
* @property-read int $microsecondsInMillennium The number of microseconds contained in the current millennium
* @property-read int $microsecondsInMillisecond The number of microseconds contained in the current millisecond
* @property-read int $microsecondsInMinute The number of microseconds contained in the current minute
* @property-read int $microsecondsInMonth The number of microseconds contained in the current month
* @property-read int $microsecondsInQuarter The number of microseconds contained in the current quarter
* @property-read int $microsecondsInSecond The number of microseconds contained in the current second
* @property-read int $microsecondsInWeek The number of microseconds contained in the current week
* @property-read int $microsecondsInYear The number of microseconds contained in the current year
* @property-read int $millisecondsInCentury The number of milliseconds contained in the current century
* @property-read int $millisecondsInDay The number of milliseconds contained in the current day
* @property-read int $millisecondsInDecade The number of milliseconds contained in the current decade
* @property-read int $millisecondsInHour The number of milliseconds contained in the current hour
* @property-read int $millisecondsInMillennium The number of milliseconds contained in the current millennium
* @property-read int $millisecondsInMinute The number of milliseconds contained in the current minute
* @property-read int $millisecondsInMonth The number of milliseconds contained in the current month
* @property-read int $millisecondsInQuarter The number of milliseconds contained in the current quarter
* @property-read int $millisecondsInSecond The number of milliseconds contained in the current second
* @property-read int $millisecondsInWeek The number of milliseconds contained in the current week
* @property-read int $millisecondsInYear The number of milliseconds contained in the current year
* @property-read int $minutesInCentury The number of minutes contained in the current century
* @property-read int $minutesInDay The number of minutes contained in the current day
* @property-read int $minutesInDecade The number of minutes contained in the current decade
* @property-read int $minutesInHour The number of minutes contained in the current hour
* @property-read int $minutesInMillennium The number of minutes contained in the current millennium
* @property-read int $minutesInMonth The number of minutes contained in the current month
* @property-read int $minutesInQuarter The number of minutes contained in the current quarter
* @property-read int $minutesInWeek The number of minutes contained in the current week
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | true |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/StaticLocalization.php | src/Carbon/Traits/StaticLocalization.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\FactoryImmutable;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Static config for localization.
*/
trait StaticLocalization
{
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* @see settings
*/
public static function setHumanDiffOptions(int $humanDiffOptions): void
{
FactoryImmutable::getDefaultInstance()->setHumanDiffOptions($humanDiffOptions);
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* @see settings
*/
public static function enableHumanDiffOption(int $humanDiffOption): void
{
FactoryImmutable::getDefaultInstance()->enableHumanDiffOption($humanDiffOption);
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* @see settings
*/
public static function disableHumanDiffOption(int $humanDiffOption): void
{
FactoryImmutable::getDefaultInstance()->disableHumanDiffOption($humanDiffOption);
}
/**
* Return default humanDiff() options (merged flags as integer).
*/
public static function getHumanDiffOptions(): int
{
return FactoryImmutable::getInstance()->getHumanDiffOptions();
}
/**
* Set the default translator instance to use.
*
* @param TranslatorInterface $translator
*
* @return void
*/
public static function setTranslator(TranslatorInterface $translator): void
{
FactoryImmutable::getDefaultInstance()->setTranslator($translator);
}
/**
* Initialize the default translator instance if necessary.
*/
public static function getTranslator(): TranslatorInterface
{
return FactoryImmutable::getInstance()->getTranslator();
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/DeprecatedPeriodProperties.php | src/Carbon/Traits/DeprecatedPeriodProperties.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\CarbonInterface;
use Carbon\CarbonInterval;
trait DeprecatedPeriodProperties
{
/**
* Period start in PHP < 8.2.
*
* @var CarbonInterface
*
* @deprecated PHP 8.2 this property is no longer in sync with the actual period start.
*/
public $start;
/**
* Period end in PHP < 8.2.
*
* @var CarbonInterface|null
*
* @deprecated PHP 8.2 this property is no longer in sync with the actual period end.
*/
public $end;
/**
* Period current iterated date in PHP < 8.2.
*
* @var CarbonInterface|null
*
* @deprecated PHP 8.2 this property is no longer in sync with the actual period current iterated date.
*/
public $current;
/**
* Period interval in PHP < 8.2.
*
* @var CarbonInterval|null
*
* @deprecated PHP 8.2 this property is no longer in sync with the actual period interval.
*/
public $interval;
/**
* Period recurrences in PHP < 8.2.
*
* @var int|float|null
*
* @deprecated PHP 8.2 this property is no longer in sync with the actual period recurrences.
*/
public $recurrences;
/**
* Period start included option in PHP < 8.2.
*
* @var bool
*
* @deprecated PHP 8.2 this property is no longer in sync with the actual period start included option.
*/
public $include_start_date;
/**
* Period end included option in PHP < 8.2.
*
* @var bool
*
* @deprecated PHP 8.2 this property is no longer in sync with the actual period end included option.
*/
public $include_end_date;
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Test.php | src/Carbon/Traits/Test.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\CarbonInterface;
use Carbon\CarbonTimeZone;
use Carbon\Factory;
use Carbon\FactoryImmutable;
use Closure;
use DateTimeImmutable;
use DateTimeInterface;
use DateTimeZone;
trait Test
{
///////////////////////////////////////////////////////////////////
///////////////////////// TESTING AIDS ////////////////////////////
///////////////////////////////////////////////////////////////////
/**
* Set a Carbon instance (real or mock) to be returned when a "now"
* instance is created. The provided instance will be returned
* specifically under the following conditions:
* - A call to the static now() method, ex. Carbon::now()
* - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null)
* - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now')
* - When a string containing the desired time is passed to Carbon::parse().
*
* Note the timezone parameter was left out of the examples above and
* has no affect as the mock value will be returned regardless of its value.
*
* Only the moment is mocked with setTestNow(), the timezone will still be the one passed
* as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()).
*
* To clear the test instance call this method using the default
* parameter of null.
*
* /!\ Use this method for unit tests only.
*
* @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance
*/
public static function setTestNow(mixed $testNow = null): void
{
FactoryImmutable::getDefaultInstance()->setTestNow($testNow);
}
/**
* Set a Carbon instance (real or mock) to be returned when a "now"
* instance is created. The provided instance will be returned
* specifically under the following conditions:
* - A call to the static now() method, ex. Carbon::now()
* - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null)
* - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now')
* - When a string containing the desired time is passed to Carbon::parse().
*
* It will also align default timezone (e.g. call date_default_timezone_set()) with
* the second argument or if null, with the timezone of the given date object.
*
* To clear the test instance call this method using the default
* parameter of null.
*
* /!\ Use this method for unit tests only.
*
* @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance
*/
public static function setTestNowAndTimezone($testNow = null, $timezone = null): void
{
FactoryImmutable::getDefaultInstance()->setTestNowAndTimezone($testNow, $timezone);
}
/**
* Temporarily sets a static date to be used within the callback.
* Using setTestNow to set the date, executing the callback, then
* clearing the test instance.
*
* /!\ Use this method for unit tests only.
*
* @template T
*
* @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance
* @param Closure(): T $callback
*
* @return T
*/
public static function withTestNow(mixed $testNow, callable $callback): mixed
{
return FactoryImmutable::getDefaultInstance()->withTestNow($testNow, $callback);
}
/**
* Get the Carbon instance (real or mock) to be returned when a "now"
* instance is created.
*
* @return Closure|CarbonInterface|null the current instance used for testing
*/
public static function getTestNow(): Closure|CarbonInterface|null
{
return FactoryImmutable::getInstance()->getTestNow();
}
/**
* Determine if there is a valid test instance set. A valid test instance
* is anything that is not null.
*
* @return bool true if there is a test instance, otherwise false
*/
public static function hasTestNow(): bool
{
return FactoryImmutable::getInstance()->hasTestNow();
}
/**
* Get the mocked date passed in setTestNow() and if it's a Closure, execute it.
*/
protected static function getMockedTestNow(DateTimeZone|string|int|null $timezone): ?CarbonInterface
{
$testNow = FactoryImmutable::getInstance()->handleTestNowClosure(static::getTestNow(), $timezone);
if ($testNow === null) {
return null;
}
$testNow = $testNow->avoidMutation();
return $timezone ? $testNow->setTimezone($timezone) : $testNow;
}
private function mockConstructorParameters(&$time, ?CarbonTimeZone $timezone): void
{
$clock = $this->clock?->unwrap();
$now = $clock instanceof Factory
? $clock->getTestNow()
: $this->nowFromClock($timezone);
$testInstance = $now ?? self::getMockedTestNowClone($timezone);
if (!$testInstance) {
return;
}
if ($testInstance instanceof DateTimeInterface) {
$testInstance = $testInstance->setTimezone($timezone ?? date_default_timezone_get());
}
if (static::hasRelativeKeywords($time)) {
$testInstance = $testInstance->modify($time);
}
$factory = $this->getClock()?->unwrap();
if (!($factory instanceof Factory)) {
$factory = FactoryImmutable::getInstance();
}
$testInstance = $factory->handleTestNowClosure($testInstance, $timezone);
$time = $testInstance instanceof self
? $testInstance->rawFormat(static::MOCK_DATETIME_FORMAT)
: $testInstance->format(static::MOCK_DATETIME_FORMAT);
}
private static function getMockedTestNowClone($timezone): CarbonInterface|self|null
{
$mock = static::getMockedTestNow($timezone);
return $mock ? clone $mock : null;
}
private function nowFromClock(?CarbonTimeZone $timezone): ?DateTimeImmutable
{
$now = $this->clock?->now();
return $now && $timezone ? $now->setTimezone($timezone) : null;
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Units.php | src/Carbon/Traits/Units.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\CarbonConverterInterface;
use Carbon\CarbonInterface;
use Carbon\CarbonInterval;
use Carbon\Exceptions\InvalidFormatException;
use Carbon\Exceptions\InvalidIntervalException;
use Carbon\Exceptions\UnitException;
use Carbon\Exceptions\UnsupportedUnitException;
use Carbon\Unit;
use Closure;
use DateInterval;
use DateMalformedStringException;
use ReturnTypeWillChange;
/**
* Trait Units.
*
* Add, subtract and set units.
*/
trait Units
{
/**
* @deprecated Prefer to use add addUTCUnit() which more accurately defines what it's doing.
*
* Add seconds to the instance using timestamp. Positive $value travels
* forward while negative $value travels into the past.
*
* @param string $unit
* @param int|float|null $value
*
* @return static
*/
public function addRealUnit(string $unit, $value = 1): static
{
return $this->addUTCUnit($unit, $value);
}
/**
* Add seconds to the instance using timestamp. Positive $value travels
* forward while negative $value travels into the past.
*
* @param string $unit
* @param int|float|null $value
*
* @return static
*/
public function addUTCUnit(string $unit, $value = 1): static
{
$value ??= 0;
switch ($unit) {
// @call addUTCUnit
case 'micro':
// @call addUTCUnit
case 'microsecond':
/* @var CarbonInterface $this */
$diff = $this->microsecond + $value;
$time = $this->getTimestamp();
$seconds = (int) floor($diff / static::MICROSECONDS_PER_SECOND);
$time += $seconds;
$diff -= $seconds * static::MICROSECONDS_PER_SECOND;
$microtime = str_pad((string) $diff, 6, '0', STR_PAD_LEFT);
$timezone = $this->tz;
return $this->tz('UTC')->modify("@$time.$microtime")->setTimezone($timezone);
// @call addUTCUnit
case 'milli':
// @call addUTCUnit
case 'millisecond':
return $this->addUTCUnit('microsecond', $value * static::MICROSECONDS_PER_MILLISECOND);
// @call addUTCUnit
case 'second':
break;
// @call addUTCUnit
case 'minute':
$value *= static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'hour':
$value *= static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'day':
$value *= static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'week':
$value *= static::DAYS_PER_WEEK * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'month':
$value *= 30 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'quarter':
$value *= static::MONTHS_PER_QUARTER * 30 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'year':
$value *= 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'decade':
$value *= static::YEARS_PER_DECADE * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'century':
$value *= static::YEARS_PER_CENTURY * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
// @call addUTCUnit
case 'millennium':
$value *= static::YEARS_PER_MILLENNIUM * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
break;
default:
if ($this->isLocalStrictModeEnabled()) {
throw new UnitException("Invalid unit for real timestamp add/sub: '$unit'");
}
return $this;
}
$seconds = (int) $value;
$microseconds = (int) round(
(abs($value) - abs($seconds)) * ($value < 0 ? -1 : 1) * static::MICROSECONDS_PER_SECOND,
);
$date = $this->setTimestamp($this->getTimestamp() + $seconds);
return $microseconds ? $date->addUTCUnit('microsecond', $microseconds) : $date;
}
/**
* @deprecated Prefer to use add subUTCUnit() which more accurately defines what it's doing.
*
* Subtract seconds to the instance using timestamp. Positive $value travels
* into the past while negative $value travels forward.
*
* @param string $unit
* @param int $value
*
* @return static
*/
public function subRealUnit($unit, $value = 1): static
{
return $this->addUTCUnit($unit, -$value);
}
/**
* Subtract seconds to the instance using timestamp. Positive $value travels
* into the past while negative $value travels forward.
*
* @param string $unit
* @param int $value
*
* @return static
*/
public function subUTCUnit($unit, $value = 1): static
{
return $this->addUTCUnit($unit, -$value);
}
/**
* Returns true if a property can be changed via setter.
*
* @param string $unit
*
* @return bool
*/
public static function isModifiableUnit($unit): bool
{
static $modifiableUnits = [
// @call addUnit
'millennium',
// @call addUnit
'century',
// @call addUnit
'decade',
// @call addUnit
'quarter',
// @call addUnit
'week',
// @call addUnit
'weekday',
];
return \in_array($unit, $modifiableUnits, true) || \in_array($unit, static::$units, true);
}
/**
* Call native PHP DateTime/DateTimeImmutable add() method.
*
* @param DateInterval $interval
*
* @return static
*/
public function rawAdd(DateInterval $interval): static
{
return parent::add($interval);
}
/**
* Add given units or interval to the current instance.
*
* @example $date->add('hour', 3)
* @example $date->add(15, 'days')
* @example $date->add(CarbonInterval::days(4))
*
* @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
* @param Unit|int|float|string $value
* @param bool|null $overflow
*
* @return static
*/
#[ReturnTypeWillChange]
public function add($unit, $value = 1, ?bool $overflow = null): static
{
$unit = Unit::toNameIfUnit($unit);
$value = Unit::toNameIfUnit($value);
if (\is_string($unit) && \func_num_args() === 1) {
$unit = CarbonInterval::make($unit, [], true);
}
if ($unit instanceof CarbonConverterInterface) {
$unit = Closure::fromCallable([$unit, 'convertDate']);
}
if ($unit instanceof Closure) {
$result = $this->resolveCarbon($unit($this, false));
if ($this !== $result && $this->isMutable()) {
return $this->modify($result->rawFormat('Y-m-d H:i:s.u e O'));
}
return $result;
}
if ($unit instanceof DateInterval) {
return parent::add($unit);
}
if (is_numeric($unit)) {
[$value, $unit] = [$unit, $value];
}
return $this->addUnit((string) $unit, $value, $overflow);
}
/**
* Add given units to the current instance.
*/
public function addUnit(Unit|string $unit, $value = 1, ?bool $overflow = null): static
{
$unit = Unit::toName($unit);
$originalArgs = \func_get_args();
$date = $this;
if (!is_numeric($value) || !(float) $value) {
return $date->isMutable() ? $date : $date->copy();
}
$unit = self::singularUnit($unit);
$metaUnits = [
'millennium' => [static::YEARS_PER_MILLENNIUM, 'year'],
'century' => [static::YEARS_PER_CENTURY, 'year'],
'decade' => [static::YEARS_PER_DECADE, 'year'],
'quarter' => [static::MONTHS_PER_QUARTER, 'month'],
];
if (isset($metaUnits[$unit])) {
[$factor, $unit] = $metaUnits[$unit];
$value *= $factor;
}
if ($unit === 'weekday') {
$weekendDays = $this->transmitFactory(static fn () => static::getWeekendDays());
if ($weekendDays !== [static::SATURDAY, static::SUNDAY]) {
$absoluteValue = abs($value);
$sign = $value / max(1, $absoluteValue);
$weekDaysCount = static::DAYS_PER_WEEK - min(static::DAYS_PER_WEEK - 1, \count(array_unique($weekendDays)));
$weeks = floor($absoluteValue / $weekDaysCount);
for ($diff = $absoluteValue % $weekDaysCount; $diff; $diff--) {
/** @var static $date */
$date = $date->addDays($sign);
while (\in_array($date->dayOfWeek, $weekendDays, true)) {
$date = $date->addDays($sign);
}
}
$value = $weeks * $sign;
$unit = 'week';
}
$timeString = $date->toTimeString();
} elseif ($canOverflow = (\in_array($unit, [
'month',
'year',
]) && ($overflow === false || (
$overflow === null &&
($ucUnit = ucfirst($unit).'s') &&
!($this->{'local'.$ucUnit.'Overflow'} ?? static::{'shouldOverflow'.$ucUnit}())
)))) {
$day = $date->day;
}
if ($unit === 'milli' || $unit === 'millisecond') {
$unit = 'microsecond';
$value *= static::MICROSECONDS_PER_MILLISECOND;
}
$previousException = null;
try {
$date = self::rawAddUnit($date, $unit, $value);
if (isset($timeString)) {
$date = $date?->setTimeFromTimeString($timeString);
} elseif (isset($canOverflow, $day) && $canOverflow && $day !== $date?->day) {
$date = $date?->modify('last day of previous month');
}
} catch (DateMalformedStringException|InvalidFormatException|UnsupportedUnitException $exception) {
$date = null;
$previousException = $exception;
}
return $date ?? throw new UnitException(
'Unable to add unit '.var_export($originalArgs, true),
previous: $previousException,
);
}
/**
* Subtract given units to the current instance.
*/
public function subUnit(Unit|string $unit, $value = 1, ?bool $overflow = null): static
{
return $this->addUnit($unit, -$value, $overflow);
}
/**
* Call native PHP DateTime/DateTimeImmutable sub() method.
*/
public function rawSub(DateInterval $interval): static
{
return parent::sub($interval);
}
/**
* Subtract given units or interval to the current instance.
*
* @example $date->sub('hour', 3)
* @example $date->sub(15, 'days')
* @example $date->sub(CarbonInterval::days(4))
*
* @param Unit|int|string|DateInterval|Closure|CarbonConverterInterface $unit
* @param Unit|int|float|string $value
* @param bool|null $overflow
*
* @return static
*/
#[ReturnTypeWillChange]
public function sub($unit, $value = 1, ?bool $overflow = null): static
{
$unit = Unit::toNameIfUnit($unit);
$value = Unit::toNameIfUnit($value);
if (\is_string($unit) && \func_num_args() === 1) {
$unit = CarbonInterval::make($unit, [], true);
}
if ($unit instanceof CarbonConverterInterface) {
$unit = Closure::fromCallable([$unit, 'convertDate']);
}
if ($unit instanceof Closure) {
$result = $this->resolveCarbon($unit($this, true));
if ($this !== $result && $this->isMutable()) {
return $this->modify($result->rawFormat('Y-m-d H:i:s.u e O'));
}
return $result;
}
if ($unit instanceof DateInterval) {
return parent::sub($unit);
}
if (is_numeric($unit)) {
[$value, $unit] = [$unit, $value];
}
return $this->addUnit((string) $unit, -(float) $value, $overflow);
}
/**
* Subtract given units or interval to the current instance.
*
* @see sub()
*
* @param Unit|int|string|DateInterval $unit
* @param Unit|int|float|string $value
* @param bool|null $overflow
*
* @return static
*/
public function subtract($unit, $value = 1, ?bool $overflow = null): static
{
if (\is_string($unit) && \func_num_args() === 1) {
$unit = CarbonInterval::make($unit, [], true);
}
return $this->sub($unit, $value, $overflow);
}
private static function rawAddUnit(self $date, string $unit, int|float $value): ?static
{
try {
return $date->rawAdd(
CarbonInterval::fromString(abs($value)." $unit")->invert($value < 0),
);
} catch (InvalidIntervalException $exception) {
try {
return $date->modify("$value $unit");
} catch (InvalidFormatException) {
throw new UnsupportedUnitException($unit, previous: $exception);
}
}
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/IntervalRounding.php | src/Carbon/Traits/IntervalRounding.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\CarbonInterval;
use Carbon\Exceptions\InvalidIntervalException;
use DateInterval;
/**
* Trait to call rounding methods to interval or the interval of a period.
*/
trait IntervalRounding
{
protected function callRoundMethod(string $method, array $parameters): ?static
{
$action = substr($method, 0, 4);
if ($action !== 'ceil') {
$action = substr($method, 0, 5);
}
if (\in_array($action, ['round', 'floor', 'ceil'])) {
return $this->{$action.'Unit'}(substr($method, \strlen($action)), ...$parameters);
}
return null;
}
protected function roundWith(DateInterval|string|float|int $precision, callable|string $function): ?static
{
$unit = 'second';
if ($precision instanceof DateInterval) {
$precision = CarbonInterval::instance($precision)->forHumans(['locale' => 'en']);
}
if (\is_string($precision) && preg_match('/^\s*(?<precision>\d+)?\s*(?<unit>\w+)(?<other>\W.*)?$/', $precision, $match)) {
if (trim($match['other'] ?? '') !== '') {
throw new InvalidIntervalException('Rounding is only possible with single unit intervals.');
}
$precision = (int) ($match['precision'] ?: 1);
$unit = $match['unit'];
}
return $this->roundUnit($unit, $precision, $function);
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Cast.php | src/Carbon/Traits/Cast.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\Exceptions\InvalidCastException;
use DateTimeInterface;
/**
* Trait Cast.
*
* Utils to cast into an other class.
*/
trait Cast
{
/**
* Cast the current instance into the given class.
*
* @template T
*
* @param class-string<T> $className The $className::instance() method will be called to cast the current object.
*
* @return T
*/
public function cast(string $className): mixed
{
if (!method_exists($className, 'instance')) {
if (is_a($className, DateTimeInterface::class, true)) {
return $className::createFromFormat('U.u', $this->rawFormat('U.u'))
->setTimezone($this->getTimezone());
}
throw new InvalidCastException("$className has not the instance() method needed to cast the date.");
}
return $className::instance($this);
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Timestamp.php | src/Carbon/Traits/Timestamp.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use DateTimeZone;
/**
* Trait Timestamp.
*/
trait Timestamp
{
/**
* Create a Carbon instance from a timestamp and set the timezone (UTC by default).
*
* Timestamp input can be given as int, float or a string containing one or more numbers.
*/
#[\ReturnTypeWillChange]
public static function createFromTimestamp(
float|int|string $timestamp,
DateTimeZone|string|int|null $timezone = null,
): static {
$date = static::createFromTimestampUTC($timestamp);
return $timezone === null ? $date : $date->setTimezone($timezone);
}
/**
* Create a Carbon instance from a timestamp keeping the timezone to UTC.
*
* Timestamp input can be given as int, float or a string containing one or more numbers.
*/
public static function createFromTimestampUTC(float|int|string $timestamp): static
{
[$integer, $decimal] = self::getIntegerAndDecimalParts($timestamp);
$delta = floor($decimal / static::MICROSECONDS_PER_SECOND);
$integer += $delta;
$decimal -= $delta * static::MICROSECONDS_PER_SECOND;
$decimal = str_pad((string) $decimal, 6, '0', STR_PAD_LEFT);
return static::rawCreateFromFormat('U u', "$integer $decimal");
}
/**
* Create a Carbon instance from a timestamp in milliseconds.
*
* Timestamp input can be given as int, float or a string containing one or more numbers.
*
* @param float|int|string $timestamp
*
* @return static
*/
public static function createFromTimestampMsUTC($timestamp): static
{
[$milliseconds, $microseconds] = self::getIntegerAndDecimalParts($timestamp, 3);
$sign = $milliseconds < 0 || ($milliseconds === 0.0 && $microseconds < 0) ? -1 : 1;
$milliseconds = abs($milliseconds);
$microseconds = $sign * abs($microseconds) + static::MICROSECONDS_PER_MILLISECOND * ($milliseconds % static::MILLISECONDS_PER_SECOND);
$seconds = $sign * floor($milliseconds / static::MILLISECONDS_PER_SECOND);
$delta = floor($microseconds / static::MICROSECONDS_PER_SECOND);
$seconds = (int) ($seconds + $delta);
$microseconds -= $delta * static::MICROSECONDS_PER_SECOND;
$microseconds = str_pad((string) (int) $microseconds, 6, '0', STR_PAD_LEFT);
return static::rawCreateFromFormat('U u', "$seconds $microseconds");
}
/**
* Create a Carbon instance from a timestamp in milliseconds.
*
* Timestamp input can be given as int, float or a string containing one or more numbers.
*/
public static function createFromTimestampMs(
float|int|string $timestamp,
DateTimeZone|string|int|null $timezone = null,
): static {
$date = static::createFromTimestampMsUTC($timestamp);
return $timezone === null ? $date : $date->setTimezone($timezone);
}
/**
* Set the instance's timestamp.
*
* Timestamp input can be given as int, float or a string containing one or more numbers.
*/
public function timestamp(float|int|string $timestamp): static
{
return $this->setTimestamp($timestamp);
}
/**
* Returns a timestamp rounded with the given precision (6 by default).
*
* @example getPreciseTimestamp() 1532087464437474 (microsecond maximum precision)
* @example getPreciseTimestamp(6) 1532087464437474
* @example getPreciseTimestamp(5) 153208746443747 (1/100000 second precision)
* @example getPreciseTimestamp(4) 15320874644375 (1/10000 second precision)
* @example getPreciseTimestamp(3) 1532087464437 (millisecond precision)
* @example getPreciseTimestamp(2) 153208746444 (1/100 second precision)
* @example getPreciseTimestamp(1) 15320874644 (1/10 second precision)
* @example getPreciseTimestamp(0) 1532087464 (second precision)
* @example getPreciseTimestamp(-1) 153208746 (10 second precision)
* @example getPreciseTimestamp(-2) 15320875 (100 second precision)
*
* @param int $precision
*
* @return float
*/
public function getPreciseTimestamp($precision = 6): float
{
return round(((float) $this->rawFormat('Uu')) / pow(10, 6 - $precision));
}
/**
* Returns the milliseconds timestamps used amongst other by Date javascript objects.
*
* @return float
*/
public function valueOf(): float
{
return $this->getPreciseTimestamp(3);
}
/**
* Returns the timestamp with millisecond precision.
*
* @return int
*/
public function getTimestampMs(): int
{
return (int) $this->getPreciseTimestamp(3);
}
/**
* @alias getTimestamp
*
* Returns the UNIX timestamp for the current date.
*
* @return int
*/
public function unix(): int
{
return $this->getTimestamp();
}
/**
* Return an array with integer part digits and decimals digits split from one or more positive numbers
* (such as timestamps) as string with the given number of decimals (6 by default).
*
* By splitting integer and decimal, this method obtain a better precision than
* number_format when the input is a string.
*
* @param float|int|string $numbers one or more numbers
* @param int $decimals number of decimals precision (6 by default)
*
* @return array 0-index is integer part, 1-index is decimal part digits
*/
private static function getIntegerAndDecimalParts($numbers, $decimals = 6): array
{
if (\is_int($numbers) || \is_float($numbers)) {
$numbers = number_format($numbers, $decimals, '.', '');
}
$sign = str_starts_with($numbers, '-') ? -1 : 1;
$integer = 0;
$decimal = 0;
foreach (preg_split('`[^\d.]+`', $numbers) as $chunk) {
[$integerPart, $decimalPart] = explode('.', "$chunk.");
$integer += (int) $integerPart;
$decimal += (float) ("0.$decimalPart");
}
$overflow = floor($decimal);
$integer += $overflow;
$decimal -= $overflow;
return [$sign * $integer, $decimal === 0.0 ? 0.0 : $sign * round($decimal * pow(10, $decimals))];
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Boundaries.php | src/Carbon/Traits/Boundaries.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\Exceptions\UnknownUnitException;
use Carbon\Unit;
use Carbon\WeekDay;
/**
* Trait Boundaries.
*
* startOf, endOf and derived method for each unit.
*
* Depends on the following properties:
*
* @property int $year
* @property int $month
* @property int $daysInMonth
* @property int $quarter
*
* Depends on the following methods:
*
* @method $this setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0)
* @method $this setDate(int $year, int $month, int $day)
* @method $this addMonths(int $value = 1)
*/
trait Boundaries
{
/**
* Resets the time to 00:00:00 start of day
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfDay();
* ```
*
* @return static
*/
public function startOfDay()
{
return $this->setTime(0, 0, 0, 0);
}
/**
* Resets the time to 23:59:59.999999 end of day
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfDay();
* ```
*
* @return static
*/
public function endOfDay()
{
return $this->setTime(static::HOURS_PER_DAY - 1, static::MINUTES_PER_HOUR - 1, static::SECONDS_PER_MINUTE - 1, static::MICROSECONDS_PER_SECOND - 1);
}
/**
* Resets the date to the first day of the month and the time to 00:00:00
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfMonth();
* ```
*
* @return static
*/
public function startOfMonth()
{
return $this->setDate($this->year, $this->month, 1)->startOfDay();
}
/**
* Resets the date to end of the month and time to 23:59:59.999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfMonth();
* ```
*
* @return static
*/
public function endOfMonth()
{
return $this->setDate($this->year, $this->month, $this->daysInMonth)->endOfDay();
}
/**
* Resets the date to the first day of the quarter and the time to 00:00:00
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfQuarter();
* ```
*
* @return static
*/
public function startOfQuarter()
{
$month = ($this->quarter - 1) * static::MONTHS_PER_QUARTER + 1;
return $this->setDate($this->year, $month, 1)->startOfDay();
}
/**
* Resets the date to end of the quarter and time to 23:59:59.999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfQuarter();
* ```
*
* @return static
*/
public function endOfQuarter()
{
return $this->startOfQuarter()->addMonths(static::MONTHS_PER_QUARTER - 1)->endOfMonth();
}
/**
* Resets the date to the first day of the year and the time to 00:00:00
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfYear();
* ```
*
* @return static
*/
public function startOfYear()
{
return $this->setDate($this->year, 1, 1)->startOfDay();
}
/**
* Resets the date to end of the year and time to 23:59:59.999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfYear();
* ```
*
* @return static
*/
public function endOfYear()
{
return $this->setDate($this->year, 12, 31)->endOfDay();
}
/**
* Resets the date to the first day of the decade and the time to 00:00:00
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfDecade();
* ```
*
* @return static
*/
public function startOfDecade()
{
$year = $this->year - $this->year % static::YEARS_PER_DECADE;
return $this->setDate($year, 1, 1)->startOfDay();
}
/**
* Resets the date to end of the decade and time to 23:59:59.999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfDecade();
* ```
*
* @return static
*/
public function endOfDecade()
{
$year = $this->year - $this->year % static::YEARS_PER_DECADE + static::YEARS_PER_DECADE - 1;
return $this->setDate($year, 12, 31)->endOfDay();
}
/**
* Resets the date to the first day of the century and the time to 00:00:00
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfCentury();
* ```
*
* @return static
*/
public function startOfCentury()
{
$year = $this->year - ($this->year - 1) % static::YEARS_PER_CENTURY;
return $this->setDate($year, 1, 1)->startOfDay();
}
/**
* Resets the date to end of the century and time to 23:59:59.999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfCentury();
* ```
*
* @return static
*/
public function endOfCentury()
{
$year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_CENTURY + static::YEARS_PER_CENTURY;
return $this->setDate($year, 12, 31)->endOfDay();
}
/**
* Resets the date to the first day of the millennium and the time to 00:00:00
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfMillennium();
* ```
*
* @return static
*/
public function startOfMillennium()
{
$year = $this->year - ($this->year - 1) % static::YEARS_PER_MILLENNIUM;
return $this->setDate($year, 1, 1)->startOfDay();
}
/**
* Resets the date to end of the millennium and time to 23:59:59.999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfMillennium();
* ```
*
* @return static
*/
public function endOfMillennium()
{
$year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_MILLENNIUM + static::YEARS_PER_MILLENNIUM;
return $this->setDate($year, 12, 31)->endOfDay();
}
/**
* Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek() . "\n";
* echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->startOfWeek() . "\n";
* echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek(Carbon::SUNDAY) . "\n";
* ```
*
* @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
*
* @return static
*/
public function startOfWeek(WeekDay|int|null $weekStartsAt = null): static
{
return $this
->subDays(
(static::DAYS_PER_WEEK + $this->dayOfWeek - (WeekDay::int($weekStartsAt) ?? $this->firstWeekDay)) %
static::DAYS_PER_WEEK,
)
->startOfDay();
}
/**
* Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek() . "\n";
* echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->endOfWeek() . "\n";
* echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek(Carbon::SATURDAY) . "\n";
* ```
*
* @param WeekDay|int|null $weekEndsAt optional end allow you to specify the day of week to use to end the week
*
* @return static
*/
public function endOfWeek(WeekDay|int|null $weekEndsAt = null): static
{
return $this
->addDays(
(static::DAYS_PER_WEEK - $this->dayOfWeek + (WeekDay::int($weekEndsAt) ?? $this->lastWeekDay)) %
static::DAYS_PER_WEEK,
)
->endOfDay();
}
/**
* Modify to start of current hour, minutes and seconds become 0
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfHour();
* ```
*/
public function startOfHour(): static
{
return $this->setTime($this->hour, 0, 0, 0);
}
/**
* Modify to end of current hour, minutes and seconds become 59
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfHour();
* ```
*/
public function endOfHour(): static
{
return $this->setTime($this->hour, static::MINUTES_PER_HOUR - 1, static::SECONDS_PER_MINUTE - 1, static::MICROSECONDS_PER_SECOND - 1);
}
/**
* Modify to start of current minute, seconds become 0
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->startOfMinute();
* ```
*/
public function startOfMinute(): static
{
return $this->setTime($this->hour, $this->minute, 0, 0);
}
/**
* Modify to end of current minute, seconds become 59
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16')->endOfMinute();
* ```
*/
public function endOfMinute(): static
{
return $this->setTime($this->hour, $this->minute, static::SECONDS_PER_MINUTE - 1, static::MICROSECONDS_PER_SECOND - 1);
}
/**
* Modify to start of current second, microseconds become 0
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16.334455')
* ->startOfSecond()
* ->format('H:i:s.u');
* ```
*/
public function startOfSecond(): static
{
return $this->setTime($this->hour, $this->minute, $this->second, 0);
}
/**
* Modify to end of current second, microseconds become 999999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16.334455')
* ->endOfSecond()
* ->format('H:i:s.u');
* ```
*/
public function endOfSecond(): static
{
return $this->setTime($this->hour, $this->minute, $this->second, static::MICROSECONDS_PER_SECOND - 1);
}
/**
* Modify to start of current millisecond, microseconds such as 12345 become 123000
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16.334455')
* ->startOfSecond()
* ->format('H:i:s.u');
* ```
*/
public function startOfMillisecond(): static
{
$millisecond = (int) floor($this->micro / 1000);
return $this->setTime($this->hour, $this->minute, $this->second, $millisecond * 1000);
}
/**
* Modify to end of current millisecond, microseconds such as 12345 become 123999
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16.334455')
* ->endOfSecond()
* ->format('H:i:s.u');
* ```
*/
public function endOfMillisecond(): static
{
$millisecond = (int) floor($this->micro / 1000);
return $this->setTime($this->hour, $this->minute, $this->second, $millisecond * 1000 + 999);
}
/**
* Modify to start of current given unit.
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16.334455')
* ->startOf(Unit::Month)
* ->endOf(Unit::Week, Carbon::FRIDAY);
* ```
*/
public function startOf(Unit|string $unit, mixed ...$params): static
{
$ucfUnit = ucfirst($unit instanceof Unit ? $unit->value : static::singularUnit($unit));
$method = "startOf$ucfUnit";
if (!method_exists($this, $method)) {
throw new UnknownUnitException($unit);
}
return $this->$method(...$params);
}
/**
* Modify to end of current given unit.
*
* @example
* ```
* echo Carbon::parse('2018-07-25 12:45:16.334455')
* ->startOf(Unit::Month)
* ->endOf(Unit::Week, Carbon::FRIDAY);
* ```
*/
public function endOf(Unit|string $unit, mixed ...$params): static
{
$ucfUnit = ucfirst($unit instanceof Unit ? $unit->value : static::singularUnit($unit));
$method = "endOf$ucfUnit";
if (!method_exists($this, $method)) {
throw new UnknownUnitException($unit);
}
return $this->$method(...$params);
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/StaticOptions.php | src/Carbon/Traits/StaticOptions.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\FactoryImmutable;
/**
* Options related to a static variable.
*/
trait StaticOptions
{
///////////////////////////////////////////////////////////////////
///////////// Behavior customization for sub-classes //////////////
///////////////////////////////////////////////////////////////////
/**
* Function to call instead of format.
*
* @var string|callable|null
*/
protected static $formatFunction;
/**
* Function to call instead of createFromFormat.
*
* @var string|callable|null
*/
protected static $createFromFormatFunction;
/**
* Function to call instead of parse.
*
* @var string|callable|null
*/
protected static $parseFunction;
///////////////////////////////////////////////////////////////////
///////////// Use default factory for static options //////////////
///////////////////////////////////////////////////////////////////
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* @see settings
*
* Enable the strict mode (or disable with passing false).
*
* @param bool $strictModeEnabled
*/
public static function useStrictMode(bool $strictModeEnabled = true): void
{
FactoryImmutable::getDefaultInstance()->useStrictMode($strictModeEnabled);
}
/**
* Returns true if the strict mode is globally in use, false else.
* (It can be overridden in specific instances.)
*
* @return bool
*/
public static function isStrictModeEnabled(): bool
{
return FactoryImmutable::getInstance()->isStrictModeEnabled();
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants
* are available for quarters, years, decade, centuries, millennia (singular and plural forms).
* @see settings
*
* Indicates if months should be calculated with overflow.
*
* @param bool $monthsOverflow
*
* @return void
*/
public static function useMonthsOverflow(bool $monthsOverflow = true): void
{
FactoryImmutable::getDefaultInstance()->useMonthsOverflow($monthsOverflow);
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants
* are available for quarters, years, decade, centuries, millennia (singular and plural forms).
* @see settings
*
* Reset the month overflow behavior.
*
* @return void
*/
public static function resetMonthsOverflow(): void
{
FactoryImmutable::getDefaultInstance()->resetMonthsOverflow();
}
/**
* Get the month overflow global behavior (can be overridden in specific instances).
*
* @return bool
*/
public static function shouldOverflowMonths(): bool
{
return FactoryImmutable::getInstance()->shouldOverflowMonths();
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants
* are available for quarters, years, decade, centuries, millennia (singular and plural forms).
* @see settings
*
* Indicates if years should be calculated with overflow.
*
* @param bool $yearsOverflow
*
* @return void
*/
public static function useYearsOverflow(bool $yearsOverflow = true): void
{
FactoryImmutable::getDefaultInstance()->useYearsOverflow($yearsOverflow);
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather use the ->settings() method.
* Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants
* are available for quarters, years, decade, centuries, millennia (singular and plural forms).
* @see settings
*
* Reset the month overflow behavior.
*
* @return void
*/
public static function resetYearsOverflow(): void
{
FactoryImmutable::getDefaultInstance()->resetYearsOverflow();
}
/**
* Get the month overflow global behavior (can be overridden in specific instances).
*
* @return bool
*/
public static function shouldOverflowYears(): bool
{
return FactoryImmutable::getInstance()->shouldOverflowYears();
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/MagicParameter.php | src/Carbon/Traits/MagicParameter.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
/**
* Trait MagicParameter.
*
* Allows to retrieve parameter in magic calls by index or name.
*/
trait MagicParameter
{
private function getMagicParameter(array $parameters, int $index, string $key, $default)
{
if (\array_key_exists($index, $parameters)) {
return $parameters[$index];
}
if (\array_key_exists($key, $parameters)) {
return $parameters[$key];
}
return $default;
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Difference.php | src/Carbon/Traits/Difference.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\CarbonInterval;
use Carbon\CarbonPeriod;
use Carbon\Exceptions\UnknownUnitException;
use Carbon\Unit;
use Closure;
use DateInterval;
use DateTimeInterface;
/**
* Trait Difference.
*
* Depends on the following methods:
*
* @method bool lessThan($date)
* @method static copy()
* @method static resolveCarbon($date = null)
*/
trait Difference
{
/**
* Get the difference as a DateInterval instance.
* Return relative interval (negative if $absolute flag is not set to true and the given date is before
* current one).
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return DateInterval
*/
public function diffAsDateInterval($date = null, bool $absolute = false): DateInterval
{
$other = $this->resolveCarbon($date);
// Work-around for https://bugs.php.net/bug.php?id=81458
// It was initially introduced for https://bugs.php.net/bug.php?id=80998
// The very specific case of 80998 was fixed in PHP 8.1beta3, but it introduced 81458
// So we still need to keep this for now
if ($other->tz !== $this->tz) {
$other = $other->avoidMutation()->setTimezone($this->tz);
}
return parent::diff($other, $absolute);
}
/**
* Get the difference as a CarbonInterval instance.
* Return relative interval (negative if $absolute flag is not set to true and the given date is before
* current one).
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return CarbonInterval
*/
public function diffAsCarbonInterval($date = null, bool $absolute = false, array $skip = []): CarbonInterval
{
return CarbonInterval::diff($this, $this->resolveCarbon($date), $absolute, $skip)
->setLocalTranslator($this->getLocalTranslator());
}
/**
* @alias diffAsCarbonInterval
*
* Get the difference as a DateInterval instance.
* Return relative interval (negative if $absolute flag is not set to true and the given date is before
* current one).
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return CarbonInterval
*/
public function diff($date = null, bool $absolute = false, array $skip = []): CarbonInterval
{
return $this->diffAsCarbonInterval($date, $absolute, $skip);
}
/**
* @param Unit|string $unit microsecond, millisecond, second, minute,
* hour, day, week, month, quarter, year,
* century, millennium
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
* @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
*
* @return float
*/
public function diffInUnit(Unit|string $unit, $date = null, bool $absolute = false, bool $utc = false): float
{
$unit = static::pluralUnit($unit instanceof Unit ? $unit->value : rtrim($unit, 'z'));
$method = 'diffIn'.$unit;
if (!method_exists($this, $method)) {
throw new UnknownUnitException($unit);
}
return $this->$method($date, $absolute, $utc);
}
/**
* Get the difference in years
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
* @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
*
* @return float
*/
public function diffInYears($date = null, bool $absolute = false, bool $utc = false): float
{
$start = $this;
$end = $this->resolveCarbon($date);
if ($utc) {
$start = $start->avoidMutation()->utc();
$end = $end->avoidMutation()->utc();
}
$ascending = ($start <= $end);
$sign = $absolute || $ascending ? 1 : -1;
if (!$ascending) {
[$start, $end] = [$end, $start];
}
$yearsDiff = (int) $start->diff($end, $absolute)->format('%r%y');
/** @var Carbon|CarbonImmutable $floorEnd */
$floorEnd = $start->avoidMutation()->addYears($yearsDiff);
if ($floorEnd >= $end) {
return $sign * $yearsDiff;
}
/** @var Carbon|CarbonImmutable $ceilEnd */
$ceilEnd = $start->avoidMutation()->addYears($yearsDiff + 1);
$daysToFloor = $floorEnd->diffInDays($end);
$daysToCeil = $end->diffInDays($ceilEnd);
return $sign * ($yearsDiff + $daysToFloor / ($daysToCeil + $daysToFloor));
}
/**
* Get the difference in quarters.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
* @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
*
* @return float
*/
public function diffInQuarters($date = null, bool $absolute = false, bool $utc = false): float
{
return $this->diffInMonths($date, $absolute, $utc) / static::MONTHS_PER_QUARTER;
}
/**
* Get the difference in months.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
* @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
*
* @return float
*/
public function diffInMonths($date = null, bool $absolute = false, bool $utc = false): float
{
$start = $this;
$end = $this->resolveCarbon($date);
// Compare using UTC
if ($utc || ($end->timezoneName !== $start->timezoneName)) {
$start = $start->avoidMutation()->utc();
$end = $end->avoidMutation()->utc();
}
[$yearStart, $monthStart, $dayStart] = explode('-', $start->format('Y-m-dHisu'));
[$yearEnd, $monthEnd, $dayEnd] = explode('-', $end->format('Y-m-dHisu'));
$monthsDiff = (((int) $yearEnd) - ((int) $yearStart)) * static::MONTHS_PER_YEAR +
((int) $monthEnd) - ((int) $monthStart);
if ($monthsDiff > 0) {
$monthsDiff -= ($dayStart > $dayEnd ? 1 : 0);
} elseif ($monthsDiff < 0) {
$monthsDiff += ($dayStart < $dayEnd ? 1 : 0);
}
$ascending = ($start <= $end);
$sign = $absolute || $ascending ? 1 : -1;
$monthsDiff = abs($monthsDiff);
if (!$ascending) {
[$start, $end] = [$end, $start];
}
/** @var Carbon|CarbonImmutable $floorEnd */
$floorEnd = $start->avoidMutation()->addMonths($monthsDiff);
if ($floorEnd >= $end) {
return $sign * $monthsDiff;
}
/** @var Carbon|CarbonImmutable $ceilEnd */
$ceilEnd = $start->avoidMutation()->addMonths($monthsDiff + 1);
$daysToFloor = $floorEnd->diffInDays($end);
$daysToCeil = $end->diffInDays($ceilEnd);
return $sign * ($monthsDiff + $daysToFloor / ($daysToCeil + $daysToFloor));
}
/**
* Get the difference in weeks.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
* @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
*
* @return float
*/
public function diffInWeeks($date = null, bool $absolute = false, bool $utc = false): float
{
return $this->diffInDays($date, $absolute, $utc) / static::DAYS_PER_WEEK;
}
/**
* Get the difference in days.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
* @param bool $utc Always convert dates to UTC before comparing (if not set, it will do it only if timezones are different)
*
* @return float
*/
public function diffInDays($date = null, bool $absolute = false, bool $utc = false): float
{
$date = $this->resolveCarbon($date);
$current = $this;
// Compare using UTC
if ($utc || ($date->timezoneName !== $current->timezoneName)) {
$date = $date->avoidMutation()->utc();
$current = $current->avoidMutation()->utc();
}
$negative = ($date < $current);
[$start, $end] = $negative ? [$date, $current] : [$current, $date];
$interval = $start->diffAsDateInterval($end);
$daysA = $this->getIntervalDayDiff($interval);
$floorEnd = $start->avoidMutation()->addDays($daysA);
$daysB = $daysA + ($floorEnd <= $end ? 1 : -1);
$ceilEnd = $start->avoidMutation()->addDays($daysB);
$microsecondsBetween = $floorEnd->diffInMicroseconds($ceilEnd);
$microsecondsToEnd = $floorEnd->diffInMicroseconds($end);
return ($negative && !$absolute ? -1 : 1)
* ($daysA * ($microsecondsBetween - $microsecondsToEnd) + $daysB * $microsecondsToEnd)
/ $microsecondsBetween;
}
/**
* Get the difference in days using a filter closure.
*
* @param Closure $callback
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return int
*/
public function diffInDaysFiltered(Closure $callback, $date = null, bool $absolute = false): int
{
return $this->diffFiltered(CarbonInterval::day(), $callback, $date, $absolute);
}
/**
* Get the difference in hours using a filter closure.
*
* @param Closure $callback
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return int
*/
public function diffInHoursFiltered(Closure $callback, $date = null, bool $absolute = false): int
{
return $this->diffFiltered(CarbonInterval::hour(), $callback, $date, $absolute);
}
/**
* Get the difference by the given interval using a filter closure.
*
* @param CarbonInterval $ci An interval to traverse by
* @param Closure $callback
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return int
*/
public function diffFiltered(CarbonInterval $ci, Closure $callback, $date = null, bool $absolute = false): int
{
$start = $this;
$end = $this->resolveCarbon($date);
$inverse = false;
if ($end < $start) {
$start = $end;
$end = $this;
$inverse = true;
}
$options = CarbonPeriod::EXCLUDE_END_DATE | ($this->isMutable() ? 0 : CarbonPeriod::IMMUTABLE);
$diff = $ci->toPeriod($start, $end, $options)->filter($callback)->count();
return $inverse && !$absolute ? -$diff : $diff;
}
/**
* Get the difference in weekdays.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return int
*/
public function diffInWeekdays($date = null, bool $absolute = false): int
{
return $this->diffInDaysFiltered(
static fn (CarbonInterface $date) => $date->isWeekday(),
$this->resolveCarbon($date)->avoidMutation()->modify($this->format('H:i:s.u')),
$absolute,
);
}
/**
* Get the difference in weekend days using a filter.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return int
*/
public function diffInWeekendDays($date = null, bool $absolute = false): int
{
return $this->diffInDaysFiltered(
static fn (CarbonInterface $date) => $date->isWeekend(),
$this->resolveCarbon($date)->avoidMutation()->modify($this->format('H:i:s.u')),
$absolute,
);
}
/**
* Get the difference in hours.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return float
*/
public function diffInHours($date = null, bool $absolute = false): float
{
return $this->diffInMinutes($date, $absolute) / static::MINUTES_PER_HOUR;
}
/**
* Get the difference in minutes.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return float
*/
public function diffInMinutes($date = null, bool $absolute = false): float
{
return $this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE;
}
/**
* Get the difference in seconds.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return float
*/
public function diffInSeconds($date = null, bool $absolute = false): float
{
return $this->diffInMilliseconds($date, $absolute) / static::MILLISECONDS_PER_SECOND;
}
/**
* Get the difference in microseconds.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return float
*/
public function diffInMicroseconds($date = null, bool $absolute = false): float
{
/** @var CarbonInterface $date */
$date = $this->resolveCarbon($date);
$value = ($date->timestamp - $this->timestamp) * static::MICROSECONDS_PER_SECOND +
$date->micro - $this->micro;
return $absolute ? abs($value) : $value;
}
/**
* Get the difference in milliseconds.
*
* @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date
* @param bool $absolute Get the absolute of the difference
*
* @return float
*/
public function diffInMilliseconds($date = null, bool $absolute = false): float
{
return $this->diffInMicroseconds($date, $absolute) / static::MICROSECONDS_PER_MILLISECOND;
}
/**
* The number of seconds since midnight.
*
* @return float
*/
public function secondsSinceMidnight(): float
{
return $this->diffInSeconds($this->copy()->startOfDay(), true);
}
/**
* The number of seconds until 23:59:59.
*
* @return float
*/
public function secondsUntilEndOfDay(): float
{
return $this->diffInSeconds($this->copy()->endOfDay(), true);
}
/**
* Get the difference in a human readable format in the current locale from current instance to an other
* instance given (or now if null given).
*
* @example
* ```
* echo Carbon::tomorrow()->diffForHumans() . "\n";
* echo Carbon::tomorrow()->diffForHumans(['parts' => 2]) . "\n";
* echo Carbon::tomorrow()->diffForHumans(['parts' => 3, 'join' => true]) . "\n";
* echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday()) . "\n";
* echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday(), ['short' => true]) . "\n";
* ```
*
* @param Carbon|DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
* if null passed, now will be used as comparison reference;
* if any other type, it will be converted to date and used as reference.
* @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
* ⦿ 'syntax' entry (see below)
* ⦿ 'short' entry (see below)
* ⦿ 'parts' entry (see below)
* ⦿ 'options' entry (see below)
* ⦿ 'skip' entry, list of units to skip (array of strings or a single string,
* ` it can be the unit name (singular or plural) or its shortcut
* ` (y, m, w, d, h, min, s, ms, µs).
* ⦿ 'aUnit' entry, prefer "an hour" over "1 hour" if true
* ⦿ 'altNumbers' entry, use alternative numbers if available
* ` (from the current language if true is passed, from the given language(s)
* ` if array or string is passed)
* ⦿ 'join' entry determines how to join multiple parts of the string
* ` - if $join is a string, it's used as a joiner glue
* ` - if $join is a callable/closure, it get the list of string and should return a string
* ` - if $join is an array, the first item will be the default glue, and the second item
* ` will be used instead of the glue for the last item
* ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
* ` - if $join is missing, a space will be used as glue
* ⦿ 'other' entry (see above)
* ⦿ 'minimumUnit' entry determines the smallest unit of time to display can be long or
* ` short form of the units, e.g. 'hour' or 'h' (default value: s)
* ⦿ 'locale' language in which the diff should be output (has no effect if 'translator' key is set)
* ⦿ 'translator' a custom translator to use to translator the output.
* if int passed, it adds modifiers:
* Possible values:
* - CarbonInterface::DIFF_ABSOLUTE no modifiers
* - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
* - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
* Default value: CarbonInterface::DIFF_ABSOLUTE
* @param bool $short displays short format of time units
* @param int $parts maximum number of parts to display (default value: 1: single unit)
* @param int $options human diff options
*/
public function diffForHumans($other = null, $syntax = null, $short = false, $parts = 1, $options = null): string
{
/* @var CarbonInterface $this */
if (\is_array($other)) {
$other['syntax'] = \array_key_exists('syntax', $other) ? $other['syntax'] : $syntax;
$syntax = $other;
$other = $syntax['other'] ?? null;
}
$intSyntax = &$syntax;
if (\is_array($syntax)) {
$syntax['syntax'] = $syntax['syntax'] ?? null;
$intSyntax = &$syntax['syntax'];
}
$intSyntax = (int) ($intSyntax ?? static::DIFF_RELATIVE_AUTO);
$intSyntax = $intSyntax === static::DIFF_RELATIVE_AUTO && $other === null ? static::DIFF_RELATIVE_TO_NOW : $intSyntax;
$parts = min(7, max(1, (int) $parts));
$skip = \is_array($syntax) ? ($syntax['skip'] ?? []) : [];
$options ??= $this->localHumanDiffOptions ?? $this->transmitFactory(
static fn () => static::getHumanDiffOptions(),
);
return $this->diff($other, skip: (array) $skip)->forHumans($syntax, (bool) $short, $parts, $options);
}
/**
* @alias diffForHumans
*
* Get the difference in a human readable format in the current locale from current instance to an other
* instance given (or now if null given).
*
* @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
* if null passed, now will be used as comparison reference;
* if any other type, it will be converted to date and used as reference.
* @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
* - 'syntax' entry (see below)
* - 'short' entry (see below)
* - 'parts' entry (see below)
* - 'options' entry (see below)
* - 'join' entry determines how to join multiple parts of the string
* ` - if $join is a string, it's used as a joiner glue
* ` - if $join is a callable/closure, it get the list of string and should return a string
* ` - if $join is an array, the first item will be the default glue, and the second item
* ` will be used instead of the glue for the last item
* ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
* ` - if $join is missing, a space will be used as glue
* - 'other' entry (see above)
* if int passed, it add modifiers:
* Possible values:
* - CarbonInterface::DIFF_ABSOLUTE no modifiers
* - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
* - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
* Default value: CarbonInterface::DIFF_ABSOLUTE
* @param bool $short displays short format of time units
* @param int $parts maximum number of parts to display (default value: 1: single unit)
* @param int $options human diff options
*
* @return string
*/
public function from($other = null, $syntax = null, $short = false, $parts = 1, $options = null)
{
return $this->diffForHumans($other, $syntax, $short, $parts, $options);
}
/**
* @alias diffForHumans
*
* Get the difference in a human readable format in the current locale from current instance to an other
* instance given (or now if null given).
*/
public function since($other = null, $syntax = null, $short = false, $parts = 1, $options = null)
{
return $this->diffForHumans($other, $syntax, $short, $parts, $options);
}
/**
* Get the difference in a human readable format in the current locale from an other
* instance given (or now if null given) to current instance.
*
* When comparing a value in the past to default now:
* 1 hour from now
* 5 months from now
*
* When comparing a value in the future to default now:
* 1 hour ago
* 5 months ago
*
* When comparing a value in the past to another value:
* 1 hour after
* 5 months after
*
* When comparing a value in the future to another value:
* 1 hour before
* 5 months before
*
* @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
* if null passed, now will be used as comparison reference;
* if any other type, it will be converted to date and used as reference.
* @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
* - 'syntax' entry (see below)
* - 'short' entry (see below)
* - 'parts' entry (see below)
* - 'options' entry (see below)
* - 'join' entry determines how to join multiple parts of the string
* ` - if $join is a string, it's used as a joiner glue
* ` - if $join is a callable/closure, it get the list of string and should return a string
* ` - if $join is an array, the first item will be the default glue, and the second item
* ` will be used instead of the glue for the last item
* ` - if $join is true, it will be guessed from the locale ('list' translation file entry)
* ` - if $join is missing, a space will be used as glue
* - 'other' entry (see above)
* if int passed, it add modifiers:
* Possible values:
* - CarbonInterface::DIFF_ABSOLUTE no modifiers
* - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier
* - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier
* Default value: CarbonInterface::DIFF_ABSOLUTE
* @param bool $short displays short format of time units
* @param int $parts maximum number of parts to display (default value: 1: single unit)
* @param int $options human diff options
*
* @return string
*/
public function to($other = null, $syntax = null, $short = false, $parts = 1, $options = null)
{
if (!$syntax && !$other) {
$syntax = CarbonInterface::DIFF_RELATIVE_TO_NOW;
}
return $this->resolveCarbon($other)->diffForHumans($this, $syntax, $short, $parts, $options);
}
/**
* @alias to
*
* Get the difference in a human readable format in the current locale from an other
* instance given (or now if null given) to current instance.
*
* @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below;
* if null passed, now will be used as comparison reference;
* if any other type, it will be converted to date and used as reference.
* @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains:
* - 'syntax' entry (see below)
* - 'short' entry (see below)
* - 'parts' entry (see below)
* - 'options' entry (see below)
* - 'join' entry determines how to join multiple parts of the string
* ` - if $join is a string, it's used as a joiner glue
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | true |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Comparison.php | src/Carbon/Traits/Comparison.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use BackedEnum;
use BadMethodCallException;
use Carbon\CarbonConverterInterface;
use Carbon\CarbonInterface;
use Carbon\Exceptions\BadComparisonUnitException;
use Carbon\FactoryImmutable;
use Carbon\Month;
use Carbon\Unit;
use Carbon\WeekDay;
use Closure;
use DateInterval;
use DateTimeInterface;
use InvalidArgumentException;
/**
* Trait Comparison.
*
* Comparison utils and testers. All the following methods return booleans.
* nowWithSameTz
*
* Depends on the following methods:
*
* @method static resolveCarbon($date)
* @method static copy()
* @method static nowWithSameTz()
* @method static static yesterday($timezone = null)
* @method static static tomorrow($timezone = null)
*/
trait Comparison
{
protected bool $endOfTime = false;
protected bool $startOfTime = false;
/**
* Determines if the instance is equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:16'); // true
* Carbon::parse('2018-07-25 12:45:16')->eq(Carbon::parse('2018-07-25 12:45:16')); // true
* Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:17'); // false
* ```
*
* @see equalTo()
*/
public function eq(DateTimeInterface|string $date): bool
{
return $this->equalTo($date);
}
/**
* Determines if the instance is equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:16'); // true
* Carbon::parse('2018-07-25 12:45:16')->equalTo(Carbon::parse('2018-07-25 12:45:16')); // true
* Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:17'); // false
* ```
*/
public function equalTo(DateTimeInterface|string $date): bool
{
return $this == $this->resolveCarbon($date);
}
/**
* Determines if the instance is not equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->ne(Carbon::parse('2018-07-25 12:45:16')); // false
* Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:17'); // true
* ```
*
* @see notEqualTo()
*/
public function ne(DateTimeInterface|string $date): bool
{
return $this->notEqualTo($date);
}
/**
* Determines if the instance is not equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->notEqualTo(Carbon::parse('2018-07-25 12:45:16')); // false
* Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:17'); // true
* ```
*/
public function notEqualTo(DateTimeInterface|string $date): bool
{
return !$this->equalTo($date);
}
/**
* Determines if the instance is greater (after) than another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:15'); // true
* Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:17'); // false
* ```
*
* @see greaterThan()
*/
public function gt(DateTimeInterface|string $date): bool
{
return $this->greaterThan($date);
}
/**
* Determines if the instance is greater (after) than another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:15'); // true
* Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:17'); // false
* ```
*/
public function greaterThan(DateTimeInterface|string $date): bool
{
return $this > $this->resolveCarbon($date);
}
/**
* Determines if the instance is greater (after) than another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:15'); // true
* Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:17'); // false
* ```
*
* @see greaterThan()
*/
public function isAfter(DateTimeInterface|string $date): bool
{
return $this->greaterThan($date);
}
/**
* Determines if the instance is greater (after) than or equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:15'); // true
* Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:16'); // true
* Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:17'); // false
* ```
*
* @see greaterThanOrEqualTo()
*/
public function gte(DateTimeInterface|string $date): bool
{
return $this->greaterThanOrEqualTo($date);
}
/**
* Determines if the instance is greater (after) than or equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:15'); // true
* Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:16'); // true
* Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:17'); // false
* ```
*/
public function greaterThanOrEqualTo(DateTimeInterface|string $date): bool
{
return $this >= $this->resolveCarbon($date);
}
/**
* Determines if the instance is less (before) than another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:15'); // false
* Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:17'); // true
* ```
*
* @see lessThan()
*/
public function lt(DateTimeInterface|string $date): bool
{
return $this->lessThan($date);
}
/**
* Determines if the instance is less (before) than another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:15'); // false
* Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:17'); // true
* ```
*/
public function lessThan(DateTimeInterface|string $date): bool
{
return $this < $this->resolveCarbon($date);
}
/**
* Determines if the instance is less (before) than another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:15'); // false
* Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:16'); // false
* Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:17'); // true
* ```
*
* @see lessThan()
*/
public function isBefore(DateTimeInterface|string $date): bool
{
return $this->lessThan($date);
}
/**
* Determines if the instance is less (before) or equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:15'); // false
* Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:16'); // true
* Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:17'); // true
* ```
*
* @see lessThanOrEqualTo()
*/
public function lte(DateTimeInterface|string $date): bool
{
return $this->lessThanOrEqualTo($date);
}
/**
* Determines if the instance is less (before) or equal to another
*
* @example
* ```
* Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:15'); // false
* Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:16'); // true
* Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:17'); // true
* ```
*/
public function lessThanOrEqualTo(DateTimeInterface|string $date): bool
{
return $this <= $this->resolveCarbon($date);
}
/**
* Determines if the instance is between two others.
*
* The third argument allow you to specify if bounds are included or not (true by default)
* but for when you including/excluding bounds may produce different results in your application,
* we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead.
*
* @example
* ```
* Carbon::parse('2018-07-25')->between('2018-07-14', '2018-08-01'); // true
* Carbon::parse('2018-07-25')->between('2018-08-01', '2018-08-20'); // false
* Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01'); // true
* Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01', false); // false
* ```
*
* @param bool $equal Indicates if an equal to comparison should be done
*/
public function between(DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = true): bool
{
$date1 = $this->resolveCarbon($date1);
$date2 = $this->resolveCarbon($date2);
if ($date1->greaterThan($date2)) {
[$date1, $date2] = [$date2, $date1];
}
if ($equal) {
return $this >= $date1 && $this <= $date2;
}
return $this > $date1 && $this < $date2;
}
/**
* Determines if the instance is between two others, bounds included.
*
* @example
* ```
* Carbon::parse('2018-07-25')->betweenIncluded('2018-07-14', '2018-08-01'); // true
* Carbon::parse('2018-07-25')->betweenIncluded('2018-08-01', '2018-08-20'); // false
* Carbon::parse('2018-07-25')->betweenIncluded('2018-07-25', '2018-08-01'); // true
* ```
*/
public function betweenIncluded(DateTimeInterface|string $date1, DateTimeInterface|string $date2): bool
{
return $this->between($date1, $date2, true);
}
/**
* Determines if the instance is between two others, bounds excluded.
*
* @example
* ```
* Carbon::parse('2018-07-25')->betweenExcluded('2018-07-14', '2018-08-01'); // true
* Carbon::parse('2018-07-25')->betweenExcluded('2018-08-01', '2018-08-20'); // false
* Carbon::parse('2018-07-25')->betweenExcluded('2018-07-25', '2018-08-01'); // false
* ```
*/
public function betweenExcluded(DateTimeInterface|string $date1, DateTimeInterface|string $date2): bool
{
return $this->between($date1, $date2, false);
}
/**
* Determines if the instance is between two others
*
* @example
* ```
* Carbon::parse('2018-07-25')->isBetween('2018-07-14', '2018-08-01'); // true
* Carbon::parse('2018-07-25')->isBetween('2018-08-01', '2018-08-20'); // false
* Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01'); // true
* Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01', false); // false
* ```
*
* @param bool $equal Indicates if an equal to comparison should be done
*/
public function isBetween(DateTimeInterface|string $date1, DateTimeInterface|string $date2, bool $equal = true): bool
{
return $this->between($date1, $date2, $equal);
}
/**
* Determines if the instance is a weekday.
*
* @example
* ```
* Carbon::parse('2019-07-14')->isWeekday(); // false
* Carbon::parse('2019-07-15')->isWeekday(); // true
* ```
*/
public function isWeekday(): bool
{
return !$this->isWeekend();
}
/**
* Determines if the instance is a weekend day.
*
* @example
* ```
* Carbon::parse('2019-07-14')->isWeekend(); // true
* Carbon::parse('2019-07-15')->isWeekend(); // false
* ```
*/
public function isWeekend(): bool
{
return \in_array(
$this->dayOfWeek,
$this->transmitFactory(static fn () => static::getWeekendDays()),
true,
);
}
/**
* Determines if the instance is yesterday.
*
* @example
* ```
* Carbon::yesterday()->isYesterday(); // true
* Carbon::tomorrow()->isYesterday(); // false
* ```
*/
public function isYesterday(): bool
{
return $this->toDateString() === $this->transmitFactory(
fn () => static::yesterday($this->getTimezone())->toDateString(),
);
}
/**
* Determines if the instance is today.
*
* @example
* ```
* Carbon::today()->isToday(); // true
* Carbon::tomorrow()->isToday(); // false
* ```
*/
public function isToday(): bool
{
return $this->toDateString() === $this->nowWithSameTz()->toDateString();
}
/**
* Determines if the instance is tomorrow.
*
* @example
* ```
* Carbon::tomorrow()->isTomorrow(); // true
* Carbon::yesterday()->isTomorrow(); // false
* ```
*/
public function isTomorrow(): bool
{
return $this->toDateString() === $this->transmitFactory(
fn () => static::tomorrow($this->getTimezone())->toDateString(),
);
}
/**
* Determines if the instance is in the future, ie. greater (after) than now.
*
* @example
* ```
* Carbon::now()->addHours(5)->isFuture(); // true
* Carbon::now()->subHours(5)->isFuture(); // false
* ```
*/
public function isFuture(): bool
{
return $this->greaterThan($this->nowWithSameTz());
}
/**
* Determines if the instance is in the past, ie. less (before) than now.
*
* @example
* ```
* Carbon::now()->subHours(5)->isPast(); // true
* Carbon::now()->addHours(5)->isPast(); // false
* ```
*/
public function isPast(): bool
{
return $this->lessThan($this->nowWithSameTz());
}
/**
* Determines if the instance is now or in the future, ie. greater (after) than or equal to now.
*
* @example
* ```
* Carbon::now()->isNowOrFuture(); // true
* Carbon::now()->addHours(5)->isNowOrFuture(); // true
* Carbon::now()->subHours(5)->isNowOrFuture(); // false
* ```
*/
public function isNowOrFuture(): bool
{
return $this->greaterThanOrEqualTo($this->nowWithSameTz());
}
/**
* Determines if the instance is now or in the past, ie. less (before) than or equal to now.
*
* @example
* ```
* Carbon::now()->isNowOrPast(); // true
* Carbon::now()->subHours(5)->isNowOrPast(); // true
* Carbon::now()->addHours(5)->isNowOrPast(); // false
* ```
*/
public function isNowOrPast(): bool
{
return $this->lessThanOrEqualTo($this->nowWithSameTz());
}
/**
* Determines if the instance is a leap year.
*
* @example
* ```
* Carbon::parse('2020-01-01')->isLeapYear(); // true
* Carbon::parse('2019-01-01')->isLeapYear(); // false
* ```
*/
public function isLeapYear(): bool
{
return $this->rawFormat('L') === '1';
}
/**
* Determines if the instance is a long year (using calendar year).
*
* ⚠️ This method completely ignores month and day to use the numeric year number,
* it's not correct if the exact date matters. For instance as `2019-12-30` is already
* in the first week of the 2020 year, if you want to know from this date if ISO week
* year 2020 is a long year, use `isLongIsoYear` instead.
*
* @example
* ```
* Carbon::create(2015)->isLongYear(); // true
* Carbon::create(2016)->isLongYear(); // false
* ```
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates
*/
public function isLongYear(): bool
{
return static::create($this->year, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === static::WEEKS_PER_YEAR + 1;
}
/**
* Determines if the instance is a long year (using ISO 8601 year).
*
* @example
* ```
* Carbon::parse('2015-01-01')->isLongIsoYear(); // true
* Carbon::parse('2016-01-01')->isLongIsoYear(); // true
* Carbon::parse('2016-01-03')->isLongIsoYear(); // false
* Carbon::parse('2019-12-29')->isLongIsoYear(); // false
* Carbon::parse('2019-12-30')->isLongIsoYear(); // true
* ```
*
* @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates
*/
public function isLongIsoYear(): bool
{
return static::create($this->isoWeekYear, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53;
}
/**
* Compares the formatted values of the two dates.
*
* @example
* ```
* Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-12-13')); // true
* Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-06-14')); // false
* ```
*
* @param string $format date formats to compare.
* @param DateTimeInterface|string $date instance to compare with or null to use current day.
*/
public function isSameAs(string $format, DateTimeInterface|string $date): bool
{
return $this->rawFormat($format) === $this->resolveCarbon($date)->rawFormat($format);
}
/**
* Determines if the instance is in the current unit given.
*
* @example
* ```
* Carbon::parse('2019-01-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // true
* Carbon::parse('2018-12-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // false
* ```
*
* @param string $unit singular unit string
* @param DateTimeInterface|string $date instance to compare with or null to use current day.
*
* @throws BadComparisonUnitException
*
* @return bool
*/
public function isSameUnit(string $unit, DateTimeInterface|string $date): bool
{
if ($unit === /* @call isSameUnit */ 'quarter') {
$other = $this->resolveCarbon($date);
return $other->year === $this->year && $other->quarter === $this->quarter;
}
$units = [
// @call isSameUnit
'year' => 'Y',
// @call isSameUnit
'month' => 'Y-n',
// @call isSameUnit
'week' => 'o-W',
// @call isSameUnit
'day' => 'Y-m-d',
// @call isSameUnit
'hour' => 'Y-m-d H',
// @call isSameUnit
'minute' => 'Y-m-d H:i',
// @call isSameUnit
'second' => 'Y-m-d H:i:s',
// @call isSameUnit
'milli' => 'Y-m-d H:i:s.v',
// @call isSameUnit
'millisecond' => 'Y-m-d H:i:s.v',
// @call isSameUnit
'micro' => 'Y-m-d H:i:s.u',
// @call isSameUnit
'microsecond' => 'Y-m-d H:i:s.u',
];
if (isset($units[$unit])) {
return $this->isSameAs($units[$unit], $date);
}
if (isset($this->$unit)) {
return $this->resolveCarbon($date)->$unit === $this->$unit;
}
if ($this->isLocalStrictModeEnabled()) {
throw new BadComparisonUnitException($unit);
}
return false;
}
/**
* Determines if the instance is in the current unit given.
*
* @example
* ```
* Carbon::now()->isCurrentUnit('hour'); // true
* Carbon::now()->subHours(2)->isCurrentUnit('hour'); // false
* ```
*
* @param string $unit The unit to test.
*
* @throws BadMethodCallException
*/
public function isCurrentUnit(string $unit): bool
{
return $this->{'isSame'.ucfirst($unit)}('now');
}
/**
* Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).
*
* @example
* ```
* Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-03-01')); // true
* Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-04-01')); // false
* Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01')); // false
* Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01'), false); // true
* ```
*
* @param DateTimeInterface|string $date The instance to compare with or null to use current day.
* @param bool $ofSameYear Check if it is the same month in the same year.
*
* @return bool
*/
public function isSameQuarter(DateTimeInterface|string $date, bool $ofSameYear = true): bool
{
$date = $this->resolveCarbon($date);
return $this->quarter === $date->quarter && (!$ofSameYear || $this->isSameYear($date));
}
/**
* Checks if the passed in date is in the same month as the instance´s month.
*
* @example
* ```
* Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-01-01')); // true
* Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-02-01')); // false
* Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01')); // false
* Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01'), false); // true
* ```
*
* @param DateTimeInterface|string $date The instance to compare with or null to use the current date.
* @param bool $ofSameYear Check if it is the same month in the same year.
*
* @return bool
*/
public function isSameMonth(DateTimeInterface|string $date, bool $ofSameYear = true): bool
{
return $this->isSameAs($ofSameYear ? 'Y-m' : 'm', $date);
}
/**
* Checks if this day is a specific day of the week.
*
* @example
* ```
* Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::WEDNESDAY); // true
* Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::FRIDAY); // false
* Carbon::parse('2019-07-17')->isDayOfWeek('Wednesday'); // true
* Carbon::parse('2019-07-17')->isDayOfWeek('Friday'); // false
* ```
*
* @param int|string $dayOfWeek
*
* @return bool
*/
public function isDayOfWeek($dayOfWeek): bool
{
if (\is_string($dayOfWeek) && \defined($constant = static::class.'::'.strtoupper($dayOfWeek))) {
$dayOfWeek = \constant($constant);
}
return $this->dayOfWeek === $dayOfWeek;
}
/**
* Check if its the birthday. Compares the date/month values of the two dates.
*
* @example
* ```
* Carbon::now()->subYears(5)->isBirthday(); // true
* Carbon::now()->subYears(5)->subDay()->isBirthday(); // false
* Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-05')); // true
* Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-06')); // false
* ```
*
* @param DateTimeInterface|string|null $date The instance to compare with or null to use current day.
*
* @return bool
*/
public function isBirthday(DateTimeInterface|string|null $date = null): bool
{
return $this->isSameAs('md', $date ?? 'now');
}
/**
* Check if today is the last day of the Month
*
* @example
* ```
* Carbon::parse('2019-02-28')->isLastOfMonth(); // true
* Carbon::parse('2019-03-28')->isLastOfMonth(); // false
* Carbon::parse('2019-03-30')->isLastOfMonth(); // false
* Carbon::parse('2019-03-31')->isLastOfMonth(); // true
* Carbon::parse('2019-04-30')->isLastOfMonth(); // true
* ```
*/
public function isLastOfMonth(): bool
{
return $this->day === $this->daysInMonth;
}
/**
* Check if the instance is start of a given unit (tolerating a given interval).
*
* @example
* ```
* // Check if a date-time is the first 15 minutes of the hour it's in
* Carbon::parse('2019-02-28 20:13:00')->isStartOfUnit(Unit::Hour, '15 minutes'); // true
* ```
*/
public function isStartOfUnit(
Unit $unit,
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
mixed ...$params,
): bool {
$interval ??= match ($unit) {
Unit::Day, Unit::Hour, Unit::Minute, Unit::Second, Unit::Millisecond, Unit::Microsecond => Unit::Microsecond,
default => Unit::Day,
};
$startOfUnit = $this->avoidMutation()->startOf($unit, ...$params);
$startOfUnitDateTime = $startOfUnit->rawFormat('Y-m-d H:i:s.u');
$maximumDateTime = $startOfUnit
->add($interval instanceof Unit ? '1 '.$interval->value : $interval)
->rawFormat('Y-m-d H:i:s.u');
if ($maximumDateTime < $startOfUnitDateTime) {
return false;
}
return $this->rawFormat('Y-m-d H:i:s.u') < $maximumDateTime;
}
/**
* Check if the instance is end of a given unit (tolerating a given interval).
*
* @example
* ```
* // Check if a date-time is the last 15 minutes of the hour it's in
* Carbon::parse('2019-02-28 20:13:00')->isEndOfUnit(Unit::Hour, '15 minutes'); // false
* ```
*/
public function isEndOfUnit(
Unit $unit,
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
mixed ...$params,
): bool {
$interval ??= match ($unit) {
Unit::Day, Unit::Hour, Unit::Minute, Unit::Second, Unit::Millisecond, Unit::Microsecond => Unit::Microsecond,
default => Unit::Day,
};
$endOfUnit = $this->avoidMutation()->endOf($unit, ...$params);
$endOfUnitDateTime = $endOfUnit->rawFormat('Y-m-d H:i:s.u');
$minimumDateTime = $endOfUnit
->sub($interval instanceof Unit ? '1 '.$interval->value : $interval)
->rawFormat('Y-m-d H:i:s.u');
if ($minimumDateTime > $endOfUnitDateTime) {
return false;
}
return $this->rawFormat('Y-m-d H:i:s.u') > $minimumDateTime;
}
/**
* Determines if the instance is start of millisecond (first microsecond by default but interval can be customized).
*/
public function isStartOfMillisecond(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isStartOfUnit(Unit::Millisecond, $interval);
}
/**
* Determines if the instance is end of millisecond (last microsecond by default but interval can be customized).
*/
public function isEndOfMillisecond(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isEndOfUnit(Unit::Millisecond, $interval);
}
/**
* Determines if the instance is start of second (first microsecond by default but interval can be customized).
*/
public function isStartOfSecond(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isStartOfUnit(Unit::Second, $interval);
}
/**
* Determines if the instance is end of second (last microsecond by default but interval can be customized).
*/
public function isEndOfSecond(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isEndOfUnit(Unit::Second, $interval);
}
/**
* Determines if the instance is start of minute (first microsecond by default but interval can be customized).
*/
public function isStartOfMinute(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isStartOfUnit(Unit::Minute, $interval);
}
/**
* Determines if the instance is end of minute (last microsecond by default but interval can be customized).
*/
public function isEndOfMinute(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isEndOfUnit(Unit::Minute, $interval);
}
/**
* Determines if the instance is start of hour (first microsecond by default but interval can be customized).
*/
public function isStartOfHour(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isStartOfUnit(Unit::Hour, $interval);
}
/**
* Determines if the instance is end of hour (last microsecond by default but interval can be customized).
*/
public function isEndOfHour(
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
return $this->isEndOfUnit(Unit::Hour, $interval);
}
/**
* Check if the instance is start of day / midnight.
*
* @example
* ```
* Carbon::parse('2019-02-28 00:00:00')->isStartOfDay(); // true
* Carbon::parse('2019-02-28 00:00:00.999999')->isStartOfDay(); // true
* Carbon::parse('2019-02-28 00:00:01')->isStartOfDay(); // false
* Carbon::parse('2019-02-28 00:00:00.000000')->isStartOfDay(true); // true
* Carbon::parse('2019-02-28 00:00:00.000012')->isStartOfDay(true); // false
* ```
*
* @param bool $checkMicroseconds check time at microseconds precision
* @param Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval if an interval is specified it will be used as precision
* for instance with "15 minutes", it checks if current date-time
* is in the last 15 minutes of the day, with Unit::Hour, it
* checks if it's in the last hour of the day.
*/
public function isStartOfDay(
Unit|DateInterval|Closure|CarbonConverterInterface|string|bool $checkMicroseconds = false,
Unit|DateInterval|Closure|CarbonConverterInterface|string|null $interval = null,
): bool {
if ($checkMicroseconds === true) {
@trigger_error(
"Since 3.8.0, it's deprecated to use \$checkMicroseconds.\n".
"It will be removed in 4.0.0.\n".
"Instead, you should use either isStartOfDay(interval: Unit::Microsecond) or isStartOfDay(interval: Unit::Second)\n".
'And you can now use any custom interval as precision, such as isStartOfDay(interval: "15 minutes")',
\E_USER_DEPRECATED,
);
}
if ($interval === null && !\is_bool($checkMicroseconds)) {
$interval = $checkMicroseconds;
}
if ($interval !== null) {
if ($interval instanceof Unit) {
$interval = '1 '.$interval->value;
}
$date = $this->rawFormat('Y-m-d');
$time = $this->rawFormat('H:i:s.u');
$maximum = $this->avoidMutation()->startOfDay()->add($interval);
$maximumDate = $maximum->rawFormat('Y-m-d');
if ($date === $maximumDate) {
return $time < $maximum->rawFormat('H:i:s.u');
}
return $maximumDate > $date;
}
/* @var CarbonInterface $this */
return $checkMicroseconds
? $this->rawFormat('H:i:s.u') === '00:00:00.000000'
: $this->rawFormat('H:i:s') === '00:00:00';
}
/**
* Check if the instance is end of day.
*
* @example
* ```
* Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(); // true
* Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(); // true
* Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(); // true
* Carbon::parse('2019-02-28 23:59:58.999999')->isEndOfDay(); // false
* Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(true); // true
* Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(true); // false
* Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(true); // false
* ```
*
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | true |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/LocalFactory.php | src/Carbon/Traits/LocalFactory.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\Factory;
use Carbon\FactoryImmutable;
use Carbon\WrapperClock;
use Closure;
/**
* Remember the factory that was the current at the creation of the object.
*/
trait LocalFactory
{
/**
* The clock that generated the current instance (or FactoryImmutable::getDefaultInstance() if none)
*/
private ?WrapperClock $clock = null;
public function getClock(): ?WrapperClock
{
return $this->clock;
}
private function initLocalFactory(): void
{
$this->clock = FactoryImmutable::getCurrentClock();
}
/**
* Trigger the given action using the local factory of the object, so it will be transmitted
* to any object also using this trait and calling initLocalFactory() in its constructor.
*
* @template T
*
* @param Closure(): T $action
*
* @return T
*/
private function transmitFactory(Closure $action): mixed
{
$previousClock = FactoryImmutable::getCurrentClock();
FactoryImmutable::setCurrentClock($this->clock);
try {
return $action();
} finally {
FactoryImmutable::setCurrentClock($previousClock);
}
}
private function getFactory(): Factory
{
return $this->getClock()?->getFactory() ?? FactoryImmutable::getDefaultInstance();
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Rounding.php | src/Carbon/Traits/Rounding.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\CarbonInterface;
use Carbon\Exceptions\UnknownUnitException;
use Carbon\WeekDay;
use DateInterval;
/**
* Trait Rounding.
*
* Round, ceil, floor units.
*
* Depends on the following methods:
*
* @method static copy()
* @method static startOfWeek(int $weekStartsAt = null)
*/
trait Rounding
{
use IntervalRounding;
/**
* Round the current instance at the given unit with given precision if specified and the given function.
*/
public function roundUnit(
string $unit,
DateInterval|string|float|int $precision = 1,
callable|string $function = 'round',
): static {
$metaUnits = [
// @call roundUnit
'millennium' => [static::YEARS_PER_MILLENNIUM, 'year'],
// @call roundUnit
'century' => [static::YEARS_PER_CENTURY, 'year'],
// @call roundUnit
'decade' => [static::YEARS_PER_DECADE, 'year'],
// @call roundUnit
'quarter' => [static::MONTHS_PER_QUARTER, 'month'],
// @call roundUnit
'millisecond' => [1000, 'microsecond'],
];
$normalizedUnit = static::singularUnit($unit);
$ranges = array_merge(static::getRangesByUnit($this->daysInMonth), [
// @call roundUnit
'microsecond' => [0, 999999],
]);
$factor = 1;
if ($normalizedUnit === 'week') {
$normalizedUnit = 'day';
$precision *= static::DAYS_PER_WEEK;
}
if (isset($metaUnits[$normalizedUnit])) {
[$factor, $normalizedUnit] = $metaUnits[$normalizedUnit];
}
$precision *= $factor;
if (!isset($ranges[$normalizedUnit])) {
throw new UnknownUnitException($unit);
}
$found = false;
$fraction = 0;
$arguments = null;
$initialValue = null;
$factor = $this->year < 0 ? -1 : 1;
$changes = [];
$minimumInc = null;
foreach ($ranges as $unit => [$minimum, $maximum]) {
if ($normalizedUnit === $unit) {
$arguments = [$this->$unit, $minimum];
$initialValue = $this->$unit;
$fraction = $precision - floor($precision);
$found = true;
continue;
}
if ($found) {
$delta = $maximum + 1 - $minimum;
$factor /= $delta;
$fraction *= $delta;
$inc = ($this->$unit - $minimum) * $factor;
if ($inc !== 0.0) {
$minimumInc = $minimumInc ?? ($arguments[0] / pow(2, 52));
// If value is still the same when adding a non-zero increment/decrement,
// it means precision got lost in the addition
if (abs($inc) < $minimumInc) {
$inc = $minimumInc * ($inc < 0 ? -1 : 1);
}
// If greater than $precision, assume precision loss caused an overflow
if ($function !== 'floor' || abs($arguments[0] + $inc - $initialValue) >= $precision) {
$arguments[0] += $inc;
}
}
$changes[$unit] = round(
$minimum + ($fraction ? $fraction * $function(($this->$unit - $minimum) / $fraction) : 0),
);
// Cannot use modulo as it lose double precision
while ($changes[$unit] >= $delta) {
$changes[$unit] -= $delta;
}
$fraction -= floor($fraction);
}
}
[$value, $minimum] = $arguments;
$normalizedValue = floor($function(($value - $minimum) / $precision) * $precision + $minimum);
/** @var CarbonInterface $result */
$result = $this;
foreach ($changes as $unit => $value) {
$result = $result->$unit($value);
}
return $result->$normalizedUnit($normalizedValue);
}
/**
* Truncate the current instance at the given unit with given precision if specified.
*/
public function floorUnit(string $unit, DateInterval|string|float|int $precision = 1): static
{
return $this->roundUnit($unit, $precision, 'floor');
}
/**
* Ceil the current instance at the given unit with given precision if specified.
*/
public function ceilUnit(string $unit, DateInterval|string|float|int $precision = 1): static
{
return $this->roundUnit($unit, $precision, 'ceil');
}
/**
* Round the current instance second with given precision if specified.
*/
public function round(DateInterval|string|float|int $precision = 1, callable|string $function = 'round'): static
{
return $this->roundWith($precision, $function);
}
/**
* Round the current instance second with given precision if specified.
*/
public function floor(DateInterval|string|float|int $precision = 1): static
{
return $this->round($precision, 'floor');
}
/**
* Ceil the current instance second with given precision if specified.
*/
public function ceil(DateInterval|string|float|int $precision = 1): static
{
return $this->round($precision, 'ceil');
}
/**
* Round the current instance week.
*
* @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
*/
public function roundWeek(WeekDay|int|null $weekStartsAt = null): static
{
return $this->closest(
$this->avoidMutation()->floorWeek($weekStartsAt),
$this->avoidMutation()->ceilWeek($weekStartsAt),
);
}
/**
* Truncate the current instance week.
*
* @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
*/
public function floorWeek(WeekDay|int|null $weekStartsAt = null): static
{
return $this->startOfWeek($weekStartsAt);
}
/**
* Ceil the current instance week.
*
* @param WeekDay|int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week
*/
public function ceilWeek(WeekDay|int|null $weekStartsAt = null): static
{
if ($this->isMutable()) {
$startOfWeek = $this->avoidMutation()->startOfWeek($weekStartsAt);
return $startOfWeek != $this ?
$this->startOfWeek($weekStartsAt)->addWeek() :
$this;
}
$startOfWeek = $this->startOfWeek($weekStartsAt);
return $startOfWeek != $this ?
$startOfWeek->addWeek() :
$this->avoidMutation();
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Converter.php | src/Carbon/Traits/Converter.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\CarbonInterval;
use Carbon\CarbonPeriod;
use Carbon\CarbonPeriodImmutable;
use Carbon\Exceptions\UnitException;
use Closure;
use DateTime;
use DateTimeImmutable;
use DateTimeInterface;
/**
* Trait Converter.
*
* Change date into different string formats and types and
* handle the string cast.
*
* Depends on the following methods:
*
* @method static copy()
*/
trait Converter
{
use ToStringFormat;
/**
* Returns the formatted date string on success or FALSE on failure.
*
* @see https://php.net/manual/en/datetime.format.php
*/
public function format(string $format): string
{
$function = $this->localFormatFunction
?? $this->getFactory()->getSettings()['formatFunction']
?? static::$formatFunction;
if (!$function) {
return $this->rawFormat($format);
}
if (\is_string($function) && method_exists($this, $function)) {
$function = [$this, $function];
}
return $function(...\func_get_args());
}
/**
* @see https://php.net/manual/en/datetime.format.php
*/
public function rawFormat(string $format): string
{
return parent::format($format);
}
/**
* Format the instance as a string using the set format
*
* @example
* ```
* echo Carbon::now(); // Carbon instances can be cast to string
* ```
*/
public function __toString(): string
{
$format = $this->localToStringFormat
?? $this->getFactory()->getSettings()['toStringFormat']
?? null;
return $format instanceof Closure
? $format($this)
: $this->rawFormat($format ?: (
\defined('static::DEFAULT_TO_STRING_FORMAT')
? static::DEFAULT_TO_STRING_FORMAT
: CarbonInterface::DEFAULT_TO_STRING_FORMAT
));
}
/**
* Format the instance as date
*
* @example
* ```
* echo Carbon::now()->toDateString();
* ```
*/
public function toDateString(): string
{
return $this->rawFormat('Y-m-d');
}
/**
* Format the instance as a readable date
*
* @example
* ```
* echo Carbon::now()->toFormattedDateString();
* ```
*/
public function toFormattedDateString(): string
{
return $this->rawFormat('M j, Y');
}
/**
* Format the instance with the day, and a readable date
*
* @example
* ```
* echo Carbon::now()->toFormattedDayDateString();
* ```
*/
public function toFormattedDayDateString(): string
{
return $this->rawFormat('D, M j, Y');
}
/**
* Format the instance as time
*
* @example
* ```
* echo Carbon::now()->toTimeString();
* ```
*/
public function toTimeString(string $unitPrecision = 'second'): string
{
return $this->rawFormat(static::getTimeFormatByPrecision($unitPrecision));
}
/**
* Format the instance as date and time
*
* @example
* ```
* echo Carbon::now()->toDateTimeString();
* ```
*/
public function toDateTimeString(string $unitPrecision = 'second'): string
{
return $this->rawFormat('Y-m-d '.static::getTimeFormatByPrecision($unitPrecision));
}
/**
* Return a format from H:i to H:i:s.u according to given unit precision.
*
* @param string $unitPrecision "minute", "second", "millisecond" or "microsecond"
*/
public static function getTimeFormatByPrecision(string $unitPrecision): string
{
return match (static::singularUnit($unitPrecision)) {
'minute' => 'H:i',
'second' => 'H:i:s',
'm', 'millisecond' => 'H:i:s.v',
'µ', 'microsecond' => 'H:i:s.u',
default => throw new UnitException('Precision unit expected among: minute, second, millisecond and microsecond.'),
};
}
/**
* Format the instance as date and time T-separated with no timezone
*
* @example
* ```
* echo Carbon::now()->toDateTimeLocalString();
* echo "\n";
* echo Carbon::now()->toDateTimeLocalString('minute'); // You can specify precision among: minute, second, millisecond and microsecond
* ```
*/
public function toDateTimeLocalString(string $unitPrecision = 'second'): string
{
return $this->rawFormat('Y-m-d\T'.static::getTimeFormatByPrecision($unitPrecision));
}
/**
* Format the instance with day, date and time
*
* @example
* ```
* echo Carbon::now()->toDayDateTimeString();
* ```
*/
public function toDayDateTimeString(): string
{
return $this->rawFormat('D, M j, Y g:i A');
}
/**
* Format the instance as ATOM
*
* @example
* ```
* echo Carbon::now()->toAtomString();
* ```
*/
public function toAtomString(): string
{
return $this->rawFormat(DateTime::ATOM);
}
/**
* Format the instance as COOKIE
*
* @example
* ```
* echo Carbon::now()->toCookieString();
* ```
*/
public function toCookieString(): string
{
return $this->rawFormat(DateTimeInterface::COOKIE);
}
/**
* Format the instance as ISO8601
*
* @example
* ```
* echo Carbon::now()->toIso8601String();
* ```
*/
public function toIso8601String(): string
{
return $this->toAtomString();
}
/**
* Format the instance as RFC822
*
* @example
* ```
* echo Carbon::now()->toRfc822String();
* ```
*/
public function toRfc822String(): string
{
return $this->rawFormat(DateTimeInterface::RFC822);
}
/**
* Convert the instance to UTC and return as Zulu ISO8601
*
* @example
* ```
* echo Carbon::now()->toIso8601ZuluString();
* ```
*/
public function toIso8601ZuluString(string $unitPrecision = 'second'): string
{
return $this->avoidMutation()
->utc()
->rawFormat('Y-m-d\T'.static::getTimeFormatByPrecision($unitPrecision).'\Z');
}
/**
* Format the instance as RFC850
*
* @example
* ```
* echo Carbon::now()->toRfc850String();
* ```
*/
public function toRfc850String(): string
{
return $this->rawFormat(DateTimeInterface::RFC850);
}
/**
* Format the instance as RFC1036
*
* @example
* ```
* echo Carbon::now()->toRfc1036String();
* ```
*/
public function toRfc1036String(): string
{
return $this->rawFormat(DateTimeInterface::RFC1036);
}
/**
* Format the instance as RFC1123
*
* @example
* ```
* echo Carbon::now()->toRfc1123String();
* ```
*/
public function toRfc1123String(): string
{
return $this->rawFormat(DateTimeInterface::RFC1123);
}
/**
* Format the instance as RFC2822
*
* @example
* ```
* echo Carbon::now()->toRfc2822String();
* ```
*/
public function toRfc2822String(): string
{
return $this->rawFormat(DateTimeInterface::RFC2822);
}
/**
* Format the instance as RFC3339.
*
* @example
* ```
* echo Carbon::now()->toRfc3339String() . "\n";
* echo Carbon::now()->toRfc3339String(true) . "\n";
* ```
*/
public function toRfc3339String(bool $extended = false): string
{
return $this->rawFormat($extended ? DateTimeInterface::RFC3339_EXTENDED : DateTimeInterface::RFC3339);
}
/**
* Format the instance as RSS
*
* @example
* ```
* echo Carbon::now()->toRssString();
* ```
*/
public function toRssString(): string
{
return $this->rawFormat(DateTimeInterface::RSS);
}
/**
* Format the instance as W3C
*
* @example
* ```
* echo Carbon::now()->toW3cString();
* ```
*/
public function toW3cString(): string
{
return $this->rawFormat(DateTimeInterface::W3C);
}
/**
* Format the instance as RFC7231
*
* @example
* ```
* echo Carbon::now()->toRfc7231String();
* ```
*/
public function toRfc7231String(): string
{
return $this->avoidMutation()
->setTimezone('GMT')
->rawFormat(\defined('static::RFC7231_FORMAT') ? static::RFC7231_FORMAT : CarbonInterface::RFC7231_FORMAT);
}
/**
* Get default array representation.
*
* @example
* ```
* var_dump(Carbon::now()->toArray());
* ```
*/
public function toArray(): array
{
return [
'year' => $this->year,
'month' => $this->month,
'day' => $this->day,
'dayOfWeek' => $this->dayOfWeek,
'dayOfYear' => $this->dayOfYear,
'hour' => $this->hour,
'minute' => $this->minute,
'second' => $this->second,
'micro' => $this->micro,
'timestamp' => $this->timestamp,
'formatted' => $this->rawFormat(\defined('static::DEFAULT_TO_STRING_FORMAT') ? static::DEFAULT_TO_STRING_FORMAT : CarbonInterface::DEFAULT_TO_STRING_FORMAT),
'timezone' => $this->timezone,
];
}
/**
* Get default object representation.
*
* @example
* ```
* var_dump(Carbon::now()->toObject());
* ```
*/
public function toObject(): object
{
return (object) $this->toArray();
}
/**
* Returns english human-readable complete date string.
*
* @example
* ```
* echo Carbon::now()->toString();
* ```
*/
public function toString(): string
{
return $this->avoidMutation()->locale('en')->isoFormat('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
}
/**
* Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept:
* 1977-04-22T01:00:00-05:00).
*
* @example
* ```
* echo Carbon::now('America/Toronto')->toISOString() . "\n";
* echo Carbon::now('America/Toronto')->toISOString(true) . "\n";
* ```
*
* @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC.
*/
public function toISOString(bool $keepOffset = false): ?string
{
if (!$this->isValid()) {
return null;
}
$yearFormat = $this->year < 0 || $this->year > 9999 ? 'YYYYYY' : 'YYYY';
$timezoneFormat = $keepOffset ? 'Z' : '[Z]';
$date = $keepOffset ? $this : $this->avoidMutation()->utc();
return $date->isoFormat("$yearFormat-MM-DD[T]HH:mm:ss.SSSSSS$timezoneFormat");
}
/**
* Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone.
*
* @example
* ```
* echo Carbon::now('America/Toronto')->toJSON();
* ```
*/
public function toJSON(): ?string
{
return $this->toISOString();
}
/**
* Return native DateTime PHP object matching the current instance.
*
* @example
* ```
* var_dump(Carbon::now()->toDateTime());
* ```
*/
public function toDateTime(): DateTime
{
return DateTime::createFromFormat('U.u', $this->rawFormat('U.u'))
->setTimezone($this->getTimezone());
}
/**
* Return native toDateTimeImmutable PHP object matching the current instance.
*
* @example
* ```
* var_dump(Carbon::now()->toDateTimeImmutable());
* ```
*/
public function toDateTimeImmutable(): DateTimeImmutable
{
return DateTimeImmutable::createFromFormat('U.u', $this->rawFormat('U.u'))
->setTimezone($this->getTimezone());
}
/**
* @alias toDateTime
*
* Return native DateTime PHP object matching the current instance.
*
* @example
* ```
* var_dump(Carbon::now()->toDate());
* ```
*/
public function toDate(): DateTime
{
return $this->toDateTime();
}
/**
* Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).
*
* @param \DateTimeInterface|Carbon|CarbonImmutable|int|null $end period end date or recurrences count if int
* @param int|\DateInterval|string|null $interval period default interval or number of the given $unit
* @param string|null $unit if specified, $interval must be an integer
*/
public function toPeriod($end = null, $interval = null, $unit = null): CarbonPeriod
{
if ($unit) {
$interval = CarbonInterval::make("$interval ".static::pluralUnit($unit));
}
$isDefaultInterval = !$interval;
$interval ??= CarbonInterval::day();
$class = $this->isMutable() ? CarbonPeriod::class : CarbonPeriodImmutable::class;
if (\is_int($end) || (\is_string($end) && ctype_digit($end))) {
$end = (int) $end;
}
$end ??= 1;
if (!\is_int($end)) {
$end = $this->resolveCarbon($end);
}
return new $class(
raw: [$this, CarbonInterval::make($interval), $end],
dateClass: static::class,
isDefaultInterval: $isDefaultInterval,
);
}
/**
* Create a iterable CarbonPeriod object from current date to a given end date (and optional interval).
*
* @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date
* @param int|\DateInterval|string|null $interval period default interval or number of the given $unit
* @param string|null $unit if specified, $interval must be an integer
*/
public function range($end = null, $interval = null, $unit = null): CarbonPeriod
{
return $this->toPeriod($end, $interval, $unit);
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Mixin.php | src/Carbon/Traits/Mixin.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\CarbonInterface;
use Carbon\CarbonInterval;
use Carbon\CarbonPeriod;
use Closure;
use Generator;
use ReflectionClass;
use ReflectionException;
use ReflectionMethod;
use Throwable;
/**
* Trait Mixin.
*
* Allows mixing in entire classes with multiple macros.
*/
trait Mixin
{
/**
* Stack of macro instance contexts.
*/
protected static array $macroContextStack = [];
/**
* Mix another object into the class.
*
* @example
* ```
* Carbon::mixin(new class {
* public function addMoon() {
* return function () {
* return $this->addDays(30);
* };
* }
* public function subMoon() {
* return function () {
* return $this->subDays(30);
* };
* }
* });
* $fullMoon = Carbon::create('2018-12-22');
* $nextFullMoon = $fullMoon->addMoon();
* $blackMoon = Carbon::create('2019-01-06');
* $previousBlackMoon = $blackMoon->subMoon();
* echo "$nextFullMoon\n";
* echo "$previousBlackMoon\n";
* ```
*
* @throws ReflectionException
*/
public static function mixin(object|string $mixin): void
{
\is_string($mixin) && trait_exists($mixin)
? self::loadMixinTrait($mixin)
: self::loadMixinClass($mixin);
}
/**
* @throws ReflectionException
*/
private static function loadMixinClass(object|string $mixin): void
{
$methods = (new ReflectionClass($mixin))->getMethods(
ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED,
);
foreach ($methods as $method) {
if ($method->isConstructor() || $method->isDestructor()) {
continue;
}
$macro = $method->invoke($mixin);
if (\is_callable($macro)) {
static::macro($method->name, $macro);
}
}
}
private static function loadMixinTrait(string $trait): void
{
$context = eval(self::getAnonymousClassCodeForTrait($trait));
$className = \get_class($context);
$baseClass = static::class;
foreach (self::getMixableMethods($context) as $name) {
$closureBase = Closure::fromCallable([$context, $name]);
static::macro($name, function (...$parameters) use ($closureBase, $className, $baseClass) {
$downContext = isset($this) ? ($this) : new $baseClass();
$context = isset($this) ? $this->cast($className) : new $className();
try {
// @ is required to handle error if not converted into exceptions
$closure = @$closureBase->bindTo($context);
} catch (Throwable) { // @codeCoverageIgnore
$closure = $closureBase; // @codeCoverageIgnore
}
// in case of errors not converted into exceptions
$closure = $closure ?: $closureBase;
$result = $closure(...$parameters);
if (!($result instanceof $className)) {
return $result;
}
if ($downContext instanceof CarbonInterface && $result instanceof CarbonInterface) {
if ($context !== $result) {
$downContext = $downContext->copy();
}
return $downContext
->setTimezone($result->getTimezone())
->modify($result->format('Y-m-d H:i:s.u'))
->settings($result->getSettings());
}
if ($downContext instanceof CarbonInterval && $result instanceof CarbonInterval) {
if ($context !== $result) {
$downContext = $downContext->copy();
}
$downContext->copyProperties($result);
self::copyStep($downContext, $result);
self::copyNegativeUnits($downContext, $result);
return $downContext->settings($result->getSettings());
}
if ($downContext instanceof CarbonPeriod && $result instanceof CarbonPeriod) {
if ($context !== $result) {
$downContext = $downContext->copy();
}
return $downContext
->setDates($result->getStartDate(), $result->getEndDate())
->setRecurrences($result->getRecurrences())
->setOptions($result->getOptions())
->settings($result->getSettings());
}
return $result;
});
}
}
private static function getAnonymousClassCodeForTrait(string $trait): string
{
return 'return new class() extends '.static::class.' {use '.$trait.';};';
}
private static function getMixableMethods(self $context): Generator
{
foreach (get_class_methods($context) as $name) {
if (method_exists(static::class, $name)) {
continue;
}
yield $name;
}
}
/**
* Stack a Carbon context from inside calls of self::this() and execute a given action.
*/
protected static function bindMacroContext(?self $context, callable $callable): mixed
{
static::$macroContextStack[] = $context;
try {
return $callable();
} finally {
array_pop(static::$macroContextStack);
}
}
/**
* Return the current context from inside a macro callee or a null if static.
*/
protected static function context(): ?static
{
return end(static::$macroContextStack) ?: null;
}
/**
* Return the current context from inside a macro callee or a new one if static.
*/
protected static function this(): static
{
return end(static::$macroContextStack) ?: new static();
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Mutability.php | src/Carbon/Traits/Mutability.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
/**
* Trait Mutability.
*
* Utils to know if the current object is mutable or immutable and convert it.
*/
trait Mutability
{
use Cast;
/**
* Returns true if the current class/instance is mutable.
*/
public static function isMutable(): bool
{
return false;
}
/**
* Returns true if the current class/instance is immutable.
*/
public static function isImmutable(): bool
{
return !static::isMutable();
}
/**
* Return a mutable copy of the instance.
*/
public function toMutable(): Carbon
{
return $this->cast(Carbon::class);
}
/**
* Return an immutable copy of the instance.
*/
public function toImmutable(): CarbonImmutable
{
// Immutable objects are fine as is (uncloned)
if ($this::class === CarbonImmutable::class) {
return $this;
}
return $this->cast(CarbonImmutable::class);
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Traits/Serialization.php | src/Carbon/Traits/Serialization.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Traits;
use Carbon\Exceptions\InvalidFormatException;
use Carbon\FactoryImmutable;
use DateTimeZone;
use ReturnTypeWillChange;
use Throwable;
/**
* Trait Serialization.
*
* Serialization and JSON stuff.
*
* Depends on the following properties:
*
* @property int $year
* @property int $month
* @property int $daysInMonth
* @property int $quarter
*
* Depends on the following methods:
*
* @method string|static locale(string $locale = null, string ...$fallbackLocales)
* @method string toJSON()
*/
trait Serialization
{
use ObjectInitialisation;
/**
* List of key to use for dump/serialization.
*
* @var string[]
*/
protected array $dumpProperties = ['date', 'timezone_type', 'timezone'];
/**
* Locale to dump comes here before serialization.
*
* @var string|null
*/
protected $dumpLocale;
/**
* Embed date properties to dump in a dedicated variables so it won't overlap native
* DateTime ones.
*
* @var array|null
*/
protected $dumpDateProperties;
/**
* Return a serialized string of the instance.
*/
public function serialize(): string
{
return serialize($this);
}
/**
* Create an instance from a serialized string.
*
* If $value is not from a trusted source, consider using the allowed_classes option to limit
* the types of objects that can be built, for instance:
*
* @example
* ```php
* $object = Carbon::fromSerialized($value, ['allowed_classes' => [Carbon::class, CarbonImmutable::class]]);
* ```
*
* @param \Stringable|string $value
* @param array $options example: ['allowed_classes' => [CarbonImmutable::class]]
*
* @throws InvalidFormatException
*
* @return static
*/
public static function fromSerialized($value, array $options = []): static
{
$instance = @unserialize((string) $value, $options);
if (!$instance instanceof static) {
throw new InvalidFormatException("Invalid serialized value: $value");
}
return $instance;
}
/**
* The __set_state handler.
*
* @param string|array $dump
*
* @return static
*/
#[ReturnTypeWillChange]
public static function __set_state($dump): static
{
if (\is_string($dump)) {
return static::parse($dump);
}
/** @var \DateTimeInterface $date */
$date = get_parent_class(static::class) && method_exists(parent::class, '__set_state')
? parent::__set_state((array) $dump)
: (object) $dump;
return static::instance($date);
}
/**
* Returns the values to dump on serialize() called on.
*
* @return array
*/
public function __serialize(): array
{
// @codeCoverageIgnoreStart
if (isset($this->timezone_type, $this->timezone, $this->date)) {
return [
'date' => $this->date,
'timezone_type' => $this->timezone_type,
'timezone' => $this->dumpTimezone($this->timezone),
];
}
// @codeCoverageIgnoreEnd
$timezone = $this->getTimezone();
$export = [
'date' => $this->format('Y-m-d H:i:s.u'),
'timezone_type' => $timezone->getType(),
'timezone' => $timezone->getName(),
];
// @codeCoverageIgnoreStart
if (\extension_loaded('msgpack') && isset($this->constructedObjectId)) {
$timezone = $this->timezone ?? null;
$export['dumpDateProperties'] = [
'date' => $this->format('Y-m-d H:i:s.u'),
'timezone' => $this->dumpTimezone($timezone),
];
}
// @codeCoverageIgnoreEnd
if ($this->localTranslator ?? null) {
$export['dumpLocale'] = $this->locale ?? null;
}
return $export;
}
/**
* Set locale if specified on unserialize() called.
*/
public function __unserialize(array $data): void
{
// @codeCoverageIgnoreStart
try {
$this->__construct($data['date'] ?? null, $data['timezone'] ?? null);
} catch (Throwable $exception) {
if (!isset($data['dumpDateProperties']['date'], $data['dumpDateProperties']['timezone'])) {
throw $exception;
}
try {
// FatalError occurs when calling msgpack_unpack() in PHP 7.4 or later.
['date' => $date, 'timezone' => $timezone] = $data['dumpDateProperties'];
$this->__construct($date, $timezone);
} catch (Throwable) {
throw $exception;
}
}
// @codeCoverageIgnoreEnd
if (isset($data['dumpLocale'])) {
$this->locale($data['dumpLocale']);
}
}
/**
* Prepare the object for JSON serialization.
*/
public function jsonSerialize(): mixed
{
$serializer = $this->localSerializer
?? $this->getFactory()->getSettings()['toJsonFormat']
?? null;
if ($serializer) {
return \is_string($serializer)
? $this->rawFormat($serializer)
: $serializer($this);
}
return $this->toJSON();
}
/**
* @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* You should rather transform Carbon object before the serialization.
*
* JSON serialize all Carbon instances using the given callback.
*/
public static function serializeUsing(string|callable|null $format): void
{
FactoryImmutable::getDefaultInstance()->serializeUsing($format);
}
/**
* Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.
* foreach ($date as $_) {}
* serializer($date)
* var_export($date)
* get_object_vars($date)
*/
public function cleanupDumpProperties(): self
{
// @codeCoverageIgnoreStart
if (PHP_VERSION < 8.2) {
foreach ($this->dumpProperties as $property) {
if (isset($this->$property)) {
unset($this->$property);
}
}
}
// @codeCoverageIgnoreEnd
return $this;
}
/** @codeCoverageIgnore */
private function dumpTimezone(mixed $timezone): mixed
{
return $timezone instanceof DateTimeZone ? $timezone->getName() : $timezone;
}
}
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/List/languages.php | src/Carbon/List/languages.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
* ISO 639-2
*/
'ab' => [
'isoName' => 'Abkhazian',
'nativeName' => 'аҧсуа бызшәа, аҧсшәа',
],
'aa' => [
'isoName' => 'Afar',
'nativeName' => 'Afaraf',
],
'af' => [
'isoName' => 'Afrikaans',
'nativeName' => 'Afrikaans',
],
'ak' => [
'isoName' => 'Akan',
'nativeName' => 'Akan',
],
'sq' => [
'isoName' => 'Albanian',
'nativeName' => 'Shqip',
],
'am' => [
'isoName' => 'Amharic',
'nativeName' => 'አማርኛ',
],
'ar' => [
'isoName' => 'Arabic',
'nativeName' => 'العربية',
],
'an' => [
'isoName' => 'Aragonese',
'nativeName' => 'aragonés',
],
'hy' => [
'isoName' => 'Armenian',
'nativeName' => 'Հայերեն',
],
'as' => [
'isoName' => 'Assamese',
'nativeName' => 'অসমীয়া',
],
'av' => [
'isoName' => 'Avaric',
'nativeName' => 'авар мацӀ, магӀарул мацӀ',
],
'ae' => [
'isoName' => 'Avestan',
'nativeName' => 'avesta',
],
'ay' => [
'isoName' => 'Aymara',
'nativeName' => 'aymar aru',
],
'az' => [
'isoName' => 'Azerbaijani',
'nativeName' => 'azərbaycan dili',
],
'bm' => [
'isoName' => 'Bambara',
'nativeName' => 'bamanankan',
],
'ba' => [
'isoName' => 'Bashkir',
'nativeName' => 'башҡорт теле',
],
'eu' => [
'isoName' => 'Basque',
'nativeName' => 'euskara, euskera',
],
'be' => [
'isoName' => 'Belarusian',
'nativeName' => 'беларуская мова',
],
'bn' => [
'isoName' => 'Bengali',
'nativeName' => 'বাংলা',
],
'bh' => [
'isoName' => 'Bihari languages',
'nativeName' => 'भोजपुरी',
],
'bi' => [
'isoName' => 'Bislama',
'nativeName' => 'Bislama',
],
'bs' => [
'isoName' => 'Bosnian',
'nativeName' => 'bosanski jezik',
],
'br' => [
'isoName' => 'Breton',
'nativeName' => 'brezhoneg',
],
'bg' => [
'isoName' => 'Bulgarian',
'nativeName' => 'български език',
],
'my' => [
'isoName' => 'Burmese',
'nativeName' => 'ဗမာစာ',
],
'ca' => [
'isoName' => 'Catalan, Valencian',
'nativeName' => 'català, valencià',
],
'ch' => [
'isoName' => 'Chamorro',
'nativeName' => 'Chamoru',
],
'ce' => [
'isoName' => 'Chechen',
'nativeName' => 'нохчийн мотт',
],
'ny' => [
'isoName' => 'Chichewa, Chewa, Nyanja',
'nativeName' => 'chiCheŵa, chinyanja',
],
'zh' => [
'isoName' => 'Chinese',
'nativeName' => '中文 (Zhōngwén), 汉语, 漢語',
],
'cv' => [
'isoName' => 'Chuvash',
'nativeName' => 'чӑваш чӗлхи',
],
'kw' => [
'isoName' => 'Cornish',
'nativeName' => 'Kernewek',
],
'co' => [
'isoName' => 'Corsican',
'nativeName' => 'corsu, lingua corsa',
],
'cr' => [
'isoName' => 'Cree',
'nativeName' => 'ᓀᐦᐃᔭᐍᐏᐣ',
],
'hr' => [
'isoName' => 'Croatian',
'nativeName' => 'hrvatski jezik',
],
'cs' => [
'isoName' => 'Czech',
'nativeName' => 'čeština, český jazyk',
],
'da' => [
'isoName' => 'Danish',
'nativeName' => 'dansk',
],
'dv' => [
'isoName' => 'Divehi, Dhivehi, Maldivian',
'nativeName' => 'ދިވެހި',
],
'nl' => [
'isoName' => 'Dutch, Flemish',
'nativeName' => 'Nederlands, Vlaams',
],
'dz' => [
'isoName' => 'Dzongkha',
'nativeName' => 'རྫོང་ཁ',
],
'en' => [
'isoName' => 'English',
'nativeName' => 'English',
],
'eo' => [
'isoName' => 'Esperanto',
'nativeName' => 'Esperanto',
],
'et' => [
'isoName' => 'Estonian',
'nativeName' => 'eesti, eesti keel',
],
'ee' => [
'isoName' => 'Ewe',
'nativeName' => 'Eʋegbe',
],
'fo' => [
'isoName' => 'Faroese',
'nativeName' => 'føroyskt',
],
'fj' => [
'isoName' => 'Fijian',
'nativeName' => 'vosa Vakaviti',
],
'fi' => [
'isoName' => 'Finnish',
'nativeName' => 'suomi, suomen kieli',
],
'fr' => [
'isoName' => 'French',
'nativeName' => 'français',
],
'ff' => [
'isoName' => 'Fulah',
'nativeName' => 'Fulfulde, Pulaar, Pular',
],
'gl' => [
'isoName' => 'Galician',
'nativeName' => 'Galego',
],
'ka' => [
'isoName' => 'Georgian',
'nativeName' => 'ქართული',
],
'de' => [
'isoName' => 'German',
'nativeName' => 'Deutsch',
],
'el' => [
'isoName' => 'Greek (modern)',
'nativeName' => 'ελληνικά',
],
'gn' => [
'isoName' => 'Guaraní',
'nativeName' => 'Avañe\'ẽ',
],
'gu' => [
'isoName' => 'Gujarati',
'nativeName' => 'ગુજરાતી',
],
'ht' => [
'isoName' => 'Haitian, Haitian Creole',
'nativeName' => 'Kreyòl ayisyen',
],
'ha' => [
'isoName' => 'Hausa',
'nativeName' => '(Hausa) هَوُسَ',
],
'he' => [
'isoName' => 'Hebrew (modern)',
'nativeName' => 'עברית',
],
'hz' => [
'isoName' => 'Herero',
'nativeName' => 'Otjiherero',
],
'hi' => [
'isoName' => 'Hindi',
'nativeName' => 'हिन्दी, हिंदी',
],
'ho' => [
'isoName' => 'Hiri Motu',
'nativeName' => 'Hiri Motu',
],
'hu' => [
'isoName' => 'Hungarian',
'nativeName' => 'magyar',
],
'ia' => [
'isoName' => 'Interlingua',
'nativeName' => 'Interlingua',
],
'id' => [
'isoName' => 'Indonesian',
'nativeName' => 'Bahasa Indonesia',
],
'ie' => [
'isoName' => 'Interlingue',
'nativeName' => 'Originally called Occidental; then Interlingue after WWII',
],
'ga' => [
'isoName' => 'Irish',
'nativeName' => 'Gaeilge',
],
'ig' => [
'isoName' => 'Igbo',
'nativeName' => 'Asụsụ Igbo',
],
'ik' => [
'isoName' => 'Inupiaq',
'nativeName' => 'Iñupiaq, Iñupiatun',
],
'io' => [
'isoName' => 'Ido',
'nativeName' => 'Ido',
],
'is' => [
'isoName' => 'Icelandic',
'nativeName' => 'Íslenska',
],
'it' => [
'isoName' => 'Italian',
'nativeName' => 'Italiano',
],
'iu' => [
'isoName' => 'Inuktitut',
'nativeName' => 'ᐃᓄᒃᑎᑐᑦ',
],
'ja' => [
'isoName' => 'Japanese',
'nativeName' => '日本語 (にほんご)',
],
'jv' => [
'isoName' => 'Javanese',
'nativeName' => 'ꦧꦱꦗꦮ, Basa Jawa',
],
'kl' => [
'isoName' => 'Kalaallisut, Greenlandic',
'nativeName' => 'kalaallisut, kalaallit oqaasii',
],
'kn' => [
'isoName' => 'Kannada',
'nativeName' => 'ಕನ್ನಡ',
],
'kr' => [
'isoName' => 'Kanuri',
'nativeName' => 'Kanuri',
],
'ks' => [
'isoName' => 'Kashmiri',
'nativeName' => 'कश्मीरी, كشميري',
],
'kk' => [
'isoName' => 'Kazakh',
'nativeName' => 'қазақ тілі',
],
'km' => [
'isoName' => 'Central Khmer',
'nativeName' => 'ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ',
],
'ki' => [
'isoName' => 'Kikuyu, Gikuyu',
'nativeName' => 'Gĩkũyũ',
],
'rw' => [
'isoName' => 'Kinyarwanda',
'nativeName' => 'Ikinyarwanda',
],
'ky' => [
'isoName' => 'Kirghiz, Kyrgyz',
'nativeName' => 'Кыргызча, Кыргыз тили',
],
'kv' => [
'isoName' => 'Komi',
'nativeName' => 'коми кыв',
],
'kg' => [
'isoName' => 'Kongo',
'nativeName' => 'Kikongo',
],
'ko' => [
'isoName' => 'Korean',
'nativeName' => '한국어',
],
'ku' => [
'isoName' => 'Kurdish',
'nativeName' => 'Kurdî, کوردی',
],
'kj' => [
'isoName' => 'Kuanyama, Kwanyama',
'nativeName' => 'Kuanyama',
],
'la' => [
'isoName' => 'Latin',
'nativeName' => 'latine, lingua latina',
],
'lb' => [
'isoName' => 'Luxembourgish, Letzeburgesch',
'nativeName' => 'Lëtzebuergesch',
],
'lg' => [
'isoName' => 'Ganda',
'nativeName' => 'Luganda',
],
'li' => [
'isoName' => 'Limburgan, Limburger, Limburgish',
'nativeName' => 'Limburgs',
],
'ln' => [
'isoName' => 'Lingala',
'nativeName' => 'Lingála',
],
'lo' => [
'isoName' => 'Lao',
'nativeName' => 'ພາສາລາວ',
],
'lt' => [
'isoName' => 'Lithuanian',
'nativeName' => 'lietuvių kalba',
],
'lu' => [
'isoName' => 'Luba-Katanga',
'nativeName' => 'Kiluba',
],
'lv' => [
'isoName' => 'Latvian',
'nativeName' => 'latviešu valoda',
],
'gv' => [
'isoName' => 'Manx',
'nativeName' => 'Gaelg, Gailck',
],
'mk' => [
'isoName' => 'Macedonian',
'nativeName' => 'македонски јазик',
],
'mg' => [
'isoName' => 'Malagasy',
'nativeName' => 'fiteny malagasy',
],
'ms' => [
'isoName' => 'Malay',
'nativeName' => 'Bahasa Melayu, بهاس ملايو',
],
'ml' => [
'isoName' => 'Malayalam',
'nativeName' => 'മലയാളം',
],
'mt' => [
'isoName' => 'Maltese',
'nativeName' => 'Malti',
],
'mi' => [
'isoName' => 'Maori',
'nativeName' => 'te reo Māori',
],
'mr' => [
'isoName' => 'Marathi',
'nativeName' => 'मराठी',
],
'mh' => [
'isoName' => 'Marshallese',
'nativeName' => 'Kajin M̧ajeļ',
],
'mn' => [
'isoName' => 'Mongolian',
'nativeName' => 'Монгол хэл',
],
'na' => [
'isoName' => 'Nauru',
'nativeName' => 'Dorerin Naoero',
],
'nv' => [
'isoName' => 'Navajo, Navaho',
'nativeName' => 'Diné bizaad',
],
'nd' => [
'isoName' => 'North Ndebele',
'nativeName' => 'isiNdebele',
],
'ne' => [
'isoName' => 'Nepali',
'nativeName' => 'नेपाली',
],
'ng' => [
'isoName' => 'Ndonga',
'nativeName' => 'Owambo',
],
'nb' => [
'isoName' => 'Norwegian Bokmål',
'nativeName' => 'Norsk Bokmål',
],
'nn' => [
'isoName' => 'Norwegian Nynorsk',
'nativeName' => 'Norsk Nynorsk',
],
'no' => [
'isoName' => 'Norwegian',
'nativeName' => 'Norsk',
],
'ii' => [
'isoName' => 'Sichuan Yi, Nuosu',
'nativeName' => 'ꆈꌠ꒿ Nuosuhxop',
],
'nr' => [
'isoName' => 'South Ndebele',
'nativeName' => 'isiNdebele',
],
'oc' => [
'isoName' => 'Occitan',
'nativeName' => 'occitan, lenga d\'òc',
],
'oj' => [
'isoName' => 'Ojibwa',
'nativeName' => 'ᐊᓂᔑᓈᐯᒧᐎᓐ',
],
'cu' => [
'isoName' => 'Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian',
'nativeName' => 'ѩзыкъ словѣньскъ',
],
'om' => [
'isoName' => 'Oromo',
'nativeName' => 'Afaan Oromoo',
],
'or' => [
'isoName' => 'Oriya',
'nativeName' => 'ଓଡ଼ିଆ',
],
'os' => [
'isoName' => 'Ossetian, Ossetic',
'nativeName' => 'ирон æвзаг',
],
'pa' => [
'isoName' => 'Panjabi, Punjabi',
'nativeName' => 'ਪੰਜਾਬੀ',
],
'pi' => [
'isoName' => 'Pali',
'nativeName' => 'पाऴि',
],
'fa' => [
'isoName' => 'Persian',
'nativeName' => 'فارسی',
],
'pl' => [
'isoName' => 'Polish',
'nativeName' => 'język polski, polszczyzna',
],
'ps' => [
'isoName' => 'Pashto, Pushto',
'nativeName' => 'پښتو',
],
'pt' => [
'isoName' => 'Portuguese',
'nativeName' => 'Português',
],
'qu' => [
'isoName' => 'Quechua',
'nativeName' => 'Runa Simi, Kichwa',
],
'rm' => [
'isoName' => 'Romansh',
'nativeName' => 'Rumantsch Grischun',
],
'rn' => [
'isoName' => 'Rundi',
'nativeName' => 'Ikirundi',
],
'ro' => [
'isoName' => 'Romanian, Moldavian, Moldovan',
'nativeName' => 'Română',
],
'ru' => [
'isoName' => 'Russian',
'nativeName' => 'русский',
],
'sa' => [
'isoName' => 'Sanskrit',
'nativeName' => 'संस्कृतम्',
],
'sc' => [
'isoName' => 'Sardinian',
'nativeName' => 'sardu',
],
'sd' => [
'isoName' => 'Sindhi',
'nativeName' => 'सिन्धी, سنڌي، سندھی',
],
'se' => [
'isoName' => 'Northern Sami',
'nativeName' => 'Davvisámegiella',
],
'sm' => [
'isoName' => 'Samoan',
'nativeName' => 'gagana fa\'a Samoa',
],
'sg' => [
'isoName' => 'Sango',
'nativeName' => 'yângâ tî sängö',
],
'sr' => [
'isoName' => 'Serbian',
'nativeName' => 'српски језик',
],
'gd' => [
'isoName' => 'Gaelic, Scottish Gaelic',
'nativeName' => 'Gàidhlig',
],
'sn' => [
'isoName' => 'Shona',
'nativeName' => 'chiShona',
],
'si' => [
'isoName' => 'Sinhala, Sinhalese',
'nativeName' => 'සිංහල',
],
'sk' => [
'isoName' => 'Slovak',
'nativeName' => 'Slovenčina, Slovenský Jazyk',
],
'sl' => [
'isoName' => 'Slovenian',
'nativeName' => 'Slovenski Jezik, Slovenščina',
],
'so' => [
'isoName' => 'Somali',
'nativeName' => 'Soomaaliga, af Soomaali',
],
'st' => [
'isoName' => 'Southern Sotho',
'nativeName' => 'Sesotho',
],
'es' => [
'isoName' => 'Spanish, Castilian',
'nativeName' => 'Español',
],
'su' => [
'isoName' => 'Sundanese',
'nativeName' => 'Basa Sunda',
],
'sw' => [
'isoName' => 'Swahili',
'nativeName' => 'Kiswahili',
],
'ss' => [
'isoName' => 'Swati',
'nativeName' => 'SiSwati',
],
'sv' => [
'isoName' => 'Swedish',
'nativeName' => 'Svenska',
],
'ta' => [
'isoName' => 'Tamil',
'nativeName' => 'தமிழ்',
],
'te' => [
'isoName' => 'Telugu',
'nativeName' => 'తెలుగు',
],
'tg' => [
'isoName' => 'Tajik',
'nativeName' => 'тоҷикӣ, toçikī, تاجیکی',
],
'th' => [
'isoName' => 'Thai',
'nativeName' => 'ไทย',
],
'ti' => [
'isoName' => 'Tigrinya',
'nativeName' => 'ትግርኛ',
],
'bo' => [
'isoName' => 'Tibetan',
'nativeName' => 'བོད་ཡིག',
],
'tk' => [
'isoName' => 'Turkmen',
'nativeName' => 'Türkmen, Түркмен',
],
'tl' => [
'isoName' => 'Tagalog',
'nativeName' => 'Wikang Tagalog',
],
'tn' => [
'isoName' => 'Tswana',
'nativeName' => 'Setswana',
],
'to' => [
'isoName' => 'Tongan (Tonga Islands)',
'nativeName' => 'Faka Tonga',
],
'tr' => [
'isoName' => 'Turkish',
'nativeName' => 'Türkçe',
],
'ts' => [
'isoName' => 'Tsonga',
'nativeName' => 'Xitsonga',
],
'tt' => [
'isoName' => 'Tatar',
'nativeName' => 'татар теле, tatar tele',
],
'tw' => [
'isoName' => 'Twi',
'nativeName' => 'Twi',
],
'ty' => [
'isoName' => 'Tahitian',
'nativeName' => 'Reo Tahiti',
],
'ug' => [
'isoName' => 'Uighur, Uyghur',
'nativeName' => 'Uyƣurqə, ئۇيغۇرچ',
],
'uk' => [
'isoName' => 'Ukrainian',
'nativeName' => 'Українська',
],
'ur' => [
'isoName' => 'Urdu',
'nativeName' => 'اردو',
],
'uz' => [
'isoName' => 'Uzbek',
'nativeName' => 'Oʻzbek, Ўзбек, أۇزبېك',
],
've' => [
'isoName' => 'Venda',
'nativeName' => 'Tshivenḓa',
],
'vi' => [
'isoName' => 'Vietnamese',
'nativeName' => 'Tiếng Việt',
],
'vo' => [
'isoName' => 'Volapük',
'nativeName' => 'Volapük',
],
'wa' => [
'isoName' => 'Walloon',
'nativeName' => 'Walon',
],
'cy' => [
'isoName' => 'Welsh',
'nativeName' => 'Cymraeg',
],
'wo' => [
'isoName' => 'Wolof',
'nativeName' => 'Wollof',
],
'fy' => [
'isoName' => 'Western Frisian',
'nativeName' => 'Frysk',
],
'xh' => [
'isoName' => 'Xhosa',
'nativeName' => 'isiXhosa',
],
'yi' => [
'isoName' => 'Yiddish',
'nativeName' => 'ייִדיש',
],
'yo' => [
'isoName' => 'Yoruba',
'nativeName' => 'Yorùbá',
],
'za' => [
'isoName' => 'Zhuang, Chuang',
'nativeName' => 'Saɯ cueŋƅ, Saw cuengh',
],
'zu' => [
'isoName' => 'Zulu',
'nativeName' => 'isiZulu',
],
/*
* Add ISO 639-3 languages available in Carbon
*/
'agq' => [
'isoName' => 'Aghem',
'nativeName' => 'Aghem',
],
'agr' => [
'isoName' => 'Aguaruna',
'nativeName' => 'Aguaruna',
],
'anp' => [
'isoName' => 'Angika',
'nativeName' => 'Angika',
],
'asa' => [
'isoName' => 'Asu',
'nativeName' => 'Asu',
],
'ast' => [
'isoName' => 'Asturian',
'nativeName' => 'Asturian',
],
'ayc' => [
'isoName' => 'Southern Aymara',
'nativeName' => 'Southern Aymara',
],
'bas' => [
'isoName' => 'Basaa',
'nativeName' => 'Basaa',
],
'bem' => [
'isoName' => 'Bemba',
'nativeName' => 'Bemba',
],
'bez' => [
'isoName' => 'Bena',
'nativeName' => 'Bena',
],
'bhb' => [
'isoName' => 'Bhili',
'nativeName' => 'Bhili',
],
'bho' => [
'isoName' => 'Bhojpuri',
'nativeName' => 'Bhojpuri',
],
'brx' => [
'isoName' => 'Bodo',
'nativeName' => 'Bodo',
],
'byn' => [
'isoName' => 'Bilin',
'nativeName' => 'Bilin',
],
'ccp' => [
'isoName' => 'Chakma',
'nativeName' => 'Chakma',
],
'cgg' => [
'isoName' => 'Chiga',
'nativeName' => 'Chiga',
],
'chr' => [
'isoName' => 'Cherokee',
'nativeName' => 'Cherokee',
],
'cmn' => [
'isoName' => 'Chinese',
'nativeName' => 'Chinese',
],
'crh' => [
'isoName' => 'Crimean Turkish',
'nativeName' => 'Crimean Turkish',
],
'csb' => [
'isoName' => 'Kashubian',
'nativeName' => 'Kashubian',
],
'dav' => [
'isoName' => 'Taita',
'nativeName' => 'Taita',
],
'dje' => [
'isoName' => 'Zarma',
'nativeName' => 'Zarma',
],
'doi' => [
'isoName' => 'Dogri (macrolanguage)',
'nativeName' => 'Dogri (macrolanguage)',
],
'dsb' => [
'isoName' => 'Lower Sorbian',
'nativeName' => 'Lower Sorbian',
],
'dua' => [
'isoName' => 'Duala',
'nativeName' => 'Duala',
],
'dyo' => [
'isoName' => 'Jola-Fonyi',
'nativeName' => 'Jola-Fonyi',
],
'ebu' => [
'isoName' => 'Embu',
'nativeName' => 'Embu',
],
'ewo' => [
'isoName' => 'Ewondo',
'nativeName' => 'Ewondo',
],
'fil' => [
'isoName' => 'Filipino',
'nativeName' => 'Filipino',
],
'fur' => [
'isoName' => 'Friulian',
'nativeName' => 'Friulian',
],
'gez' => [
'isoName' => 'Geez',
'nativeName' => 'Geez',
],
'gom' => [
'isoName' => 'Konkani, Goan',
'nativeName' => 'ಕೊಂಕಣಿ',
],
'gsw' => [
'isoName' => 'Swiss German',
'nativeName' => 'Swiss German',
],
'guz' => [
'isoName' => 'Gusii',
'nativeName' => 'Gusii',
],
'hak' => [
'isoName' => 'Hakka Chinese',
'nativeName' => 'Hakka Chinese',
],
'haw' => [
'isoName' => 'Hawaiian',
'nativeName' => 'Hawaiian',
],
'hif' => [
'isoName' => 'Fiji Hindi',
'nativeName' => 'Fiji Hindi',
],
'hne' => [
'isoName' => 'Chhattisgarhi',
'nativeName' => 'Chhattisgarhi',
],
'hsb' => [
'isoName' => 'Upper Sorbian',
'nativeName' => 'Upper Sorbian',
],
'jgo' => [
'isoName' => 'Ngomba',
'nativeName' => 'Ngomba',
],
'jmc' => [
'isoName' => 'Machame',
'nativeName' => 'Machame',
],
'kab' => [
'isoName' => 'Kabyle',
'nativeName' => 'Kabyle',
],
'kam' => [
'isoName' => 'Kamba',
'nativeName' => 'Kamba',
],
'kde' => [
'isoName' => 'Makonde',
'nativeName' => 'Makonde',
],
'kea' => [
'isoName' => 'Kabuverdianu',
'nativeName' => 'Kabuverdianu',
],
'khq' => [
'isoName' => 'Koyra Chiini',
'nativeName' => 'Koyra Chiini',
],
'kkj' => [
'isoName' => 'Kako',
'nativeName' => 'Kako',
],
'kln' => [
'isoName' => 'Kalenjin',
'nativeName' => 'Kalenjin',
],
'kok' => [
'isoName' => 'Konkani',
'nativeName' => 'Konkani',
],
'ksb' => [
'isoName' => 'Shambala',
'nativeName' => 'Shambala',
],
'ksf' => [
'isoName' => 'Bafia',
'nativeName' => 'Bafia',
],
'ksh' => [
'isoName' => 'Colognian',
'nativeName' => 'Colognian',
],
'lag' => [
'isoName' => 'Langi',
'nativeName' => 'Langi',
],
'lij' => [
'isoName' => 'Ligurian',
'nativeName' => 'Ligurian',
],
'lkt' => [
'isoName' => 'Lakota',
'nativeName' => 'Lakota',
],
'lrc' => [
'isoName' => 'Northern Luri',
'nativeName' => 'Northern Luri',
],
'luo' => [
'isoName' => 'Luo',
'nativeName' => 'Luo',
],
'luy' => [
'isoName' => 'Luyia',
'nativeName' => 'Luyia',
],
'lzh' => [
'isoName' => 'Literary Chinese',
'nativeName' => 'Literary Chinese',
],
'mag' => [
'isoName' => 'Magahi',
'nativeName' => 'Magahi',
],
'mai' => [
'isoName' => 'Maithili',
'nativeName' => 'Maithili',
],
'mas' => [
'isoName' => 'Masai',
'nativeName' => 'Masai',
],
'mer' => [
'isoName' => 'Meru',
'nativeName' => 'Meru',
],
'mfe' => [
'isoName' => 'Morisyen',
'nativeName' => 'Morisyen',
],
'mgh' => [
'isoName' => 'Makhuwa-Meetto',
'nativeName' => 'Makhuwa-Meetto',
],
'mgo' => [
'isoName' => 'Metaʼ',
'nativeName' => 'Metaʼ',
],
'mhr' => [
'isoName' => 'Eastern Mari',
'nativeName' => 'Eastern Mari',
],
'miq' => [
'isoName' => 'Mískito',
'nativeName' => 'Mískito',
],
'mjw' => [
'isoName' => 'Karbi',
'nativeName' => 'Karbi',
],
'mni' => [
'isoName' => 'Manipuri',
'nativeName' => 'Manipuri',
],
'mua' => [
'isoName' => 'Mundang',
'nativeName' => 'Mundang',
],
'mzn' => [
'isoName' => 'Mazanderani',
'nativeName' => 'Mazanderani',
],
'nan' => [
'isoName' => 'Min Nan Chinese',
'nativeName' => 'Min Nan Chinese',
],
'naq' => [
'isoName' => 'Nama',
'nativeName' => 'Nama',
],
'nds' => [
'isoName' => 'Low German',
'nativeName' => 'Low German',
],
'nhn' => [
'isoName' => 'Central Nahuatl',
'nativeName' => 'Central Nahuatl',
],
'niu' => [
'isoName' => 'Niuean',
'nativeName' => 'Niuean',
],
'nmg' => [
'isoName' => 'Kwasio',
'nativeName' => 'Kwasio',
],
'nnh' => [
'isoName' => 'Ngiemboon',
'nativeName' => 'Ngiemboon',
],
'nso' => [
'isoName' => 'Northern Sotho',
'nativeName' => 'Northern Sotho',
],
'nus' => [
'isoName' => 'Nuer',
'nativeName' => 'Nuer',
],
'nyn' => [
'isoName' => 'Nyankole',
'nativeName' => 'Nyankole',
],
'pap' => [
'isoName' => 'Papiamento',
'nativeName' => 'Papiamento',
],
'prg' => [
'isoName' => 'Prussian',
'nativeName' => 'Prussian',
],
'quz' => [
'isoName' => 'Cusco Quechua',
'nativeName' => 'Cusco Quechua',
],
'raj' => [
'isoName' => 'Rajasthani',
'nativeName' => 'Rajasthani',
],
'rof' => [
'isoName' => 'Rombo',
'nativeName' => 'Rombo',
],
'rwk' => [
'isoName' => 'Rwa',
'nativeName' => 'Rwa',
],
'sah' => [
'isoName' => 'Sakha',
'nativeName' => 'Sakha',
],
'saq' => [
'isoName' => 'Samburu',
'nativeName' => 'Samburu',
],
'sat' => [
'isoName' => 'Santali',
'nativeName' => 'Santali',
],
'sbp' => [
'isoName' => 'Sangu',
'nativeName' => 'Sangu',
],
'scr' => [
'isoName' => 'Serbo Croatian',
'nativeName' => 'Serbo Croatian',
],
'seh' => [
'isoName' => 'Sena',
'nativeName' => 'Sena',
],
'ses' => [
'isoName' => 'Koyraboro Senni',
'nativeName' => 'Koyraboro Senni',
],
'sgs' => [
'isoName' => 'Samogitian',
'nativeName' => 'Samogitian',
],
'shi' => [
'isoName' => 'Tachelhit',
'nativeName' => 'Tachelhit',
],
'shn' => [
'isoName' => 'Shan',
'nativeName' => 'Shan',
],
'shs' => [
'isoName' => 'Shuswap',
'nativeName' => 'Shuswap',
],
'sid' => [
'isoName' => 'Sidamo',
'nativeName' => 'Sidamo',
],
'smn' => [
'isoName' => 'Inari Sami',
'nativeName' => 'Inari Sami',
],
'szl' => [
'isoName' => 'Silesian',
'nativeName' => 'Silesian',
],
'tcy' => [
'isoName' => 'Tulu',
'nativeName' => 'Tulu',
],
'teo' => [
'isoName' => 'Teso',
'nativeName' => 'Teso',
],
'tet' => [
'isoName' => 'Tetum',
'nativeName' => 'Tetum',
],
'the' => [
'isoName' => 'Chitwania Tharu',
'nativeName' => 'Chitwania Tharu',
],
'tig' => [
'isoName' => 'Tigre',
'nativeName' => 'Tigre',
],
'tlh' => [
'isoName' => 'Klingon',
'nativeName' => 'tlhIngan Hol',
],
'tpi' => [
'isoName' => 'Tok Pisin',
'nativeName' => 'Tok Pisin',
],
'twq' => [
'isoName' => 'Tasawaq',
'nativeName' => 'Tasawaq',
],
'tzl' => [
'isoName' => 'Talossan',
'nativeName' => 'Talossan',
],
'tzm' => [
'isoName' => 'Tamazight, Central Atlas',
'nativeName' => 'ⵜⵎⴰⵣⵉⵖⵜ',
],
'unm' => [
'isoName' => 'Unami',
'nativeName' => 'Unami',
],
'vai' => [
'isoName' => 'Vai',
'nativeName' => 'Vai',
],
'vun' => [
'isoName' => 'Vunjo',
'nativeName' => 'Vunjo',
],
'wae' => [
'isoName' => 'Walser',
'nativeName' => 'Walser',
],
'wal' => [
'isoName' => 'Wolaytta',
'nativeName' => 'Wolaytta',
],
'xog' => [
'isoName' => 'Soga',
'nativeName' => 'Soga',
],
'yav' => [
'isoName' => 'Yangben',
'nativeName' => 'Yangben',
],
'yue' => [
'isoName' => 'Cantonese',
'nativeName' => 'Cantonese',
],
'yuw' => [
'isoName' => 'Yau (Morobe Province)',
'nativeName' => 'Yau (Morobe Province)',
],
'zgh' => [
'isoName' => 'Standard Moroccan Tamazight',
'nativeName' => 'Standard Moroccan Tamazight',
],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/List/regions.php | src/Carbon/List/regions.php | <?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* ISO 3166-2 short names.
*
* ⚠ Provided with No Warranty
*
* This list has no official value, and it's using short name, i.e. the first column of
* https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
*
* Without the extra parenthesis unless a particular ambiguity in the list.
*
* For instance:
* - Falkland Islands and Malvinas both to FK, but we keep only the first for brevity and
* because there is no ambiguity in the list to justify longer name.
* - For Sint Maarten/Saint Martin not to have any confusion between FM and SX codes that
* are on the same island and so to be clear it's not referring to the whole island,
* south (dutch-speaking) and north (french-speaking) parentheses are kept for disambiguation.
* - For Virgin Islands, that can refer to either VG or VI, parentheses are also kept for
* disambiguation.
*
* We won't take into consideration any change request in this list unless there is an update
* in ISO 3166-2 itself that we need to align to.
*
* It's a purely geographical helper, state sovereignty is out of scope, for political
* complains you should address them directly to https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
*
* Anyone needing official state names (such as the second column of the wikipedia page above)
* should seek for another tool, this list is not meant to provide long names.
*/
return [
'AD' => 'Andorra',
'AE' => 'United Arab Emirates',
'AF' => 'Afghanistan',
'AG' => 'Antigua and Barbuda',
'AI' => 'Anguilla',
'AL' => 'Albania',
'AM' => 'Armenia',
'AO' => 'Angola',
'AQ' => 'Antarctica',
'AR' => 'Argentina',
'AS' => 'American Samoa',
'AT' => 'Austria',
'AU' => 'Australia',
'AW' => 'Aruba',
'AX' => 'Åland Islands',
'AZ' => 'Azerbaijan',
'BA' => 'Bosnia and Herzegovina',
'BB' => 'Barbados',
'BD' => 'Bangladesh',
'BE' => 'Belgium',
'BF' => 'Burkina Faso',
'BG' => 'Bulgaria',
'BH' => 'Bahrain',
'BI' => 'Burundi',
'BJ' => 'Benin',
'BL' => 'Saint Barthélemy',
'BM' => 'Bermuda',
'BN' => 'Brunei Darussalam',
'BO' => 'Bolivia',
'BQ' => 'Bonaire, Sint Eustatius and Saba',
'BR' => 'Brazil',
'BS' => 'Bahamas',
'BT' => 'Bhutan',
'BV' => 'Bouvet Island',
'BW' => 'Botswana',
'BY' => 'Belarus',
'BZ' => 'Belize',
'CA' => 'Canada',
'CC' => 'Cocos (Keeling) Islands',
'CD' => 'Congo, Democratic Republic of the',
'CF' => 'Central African Republic',
'CG' => 'Congo',
'CH' => 'Switzerland',
'CI' => 'Côte d\'Ivoire',
'CK' => 'Cook Islands',
'CL' => 'Chile',
'CM' => 'Cameroon',
'CN' => 'China',
'CO' => 'Colombia',
'CR' => 'Costa Rica',
'CU' => 'Cuba',
'CV' => 'Cabo Verde',
'CW' => 'Curaçao',
'CX' => 'Christmas Island',
'CY' => 'Cyprus',
'CZ' => 'Czechia',
'DE' => 'Germany',
'DJ' => 'Djibouti',
'DK' => 'Denmark',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'DZ' => 'Algeria',
'EC' => 'Ecuador',
'EE' => 'Estonia',
'EG' => 'Egypt',
'EH' => 'Western Sahara',
'ER' => 'Eritrea',
'ES' => 'Spain',
'ET' => 'Ethiopia',
'FI' => 'Finland',
'FJ' => 'Fiji',
'FK' => 'Falkland Islands',
'FM' => 'Micronesia',
'FO' => 'Faroe Islands',
'FR' => 'France',
'GA' => 'Gabon',
'GB' => 'United Kingdom of Great Britain and Northern Ireland',
'GD' => 'Grenada',
'GE' => 'Georgia',
'GF' => 'French Guiana',
'GG' => 'Guernsey',
'GH' => 'Ghana',
'GI' => 'Gibraltar',
'GL' => 'Greenland',
'GM' => 'Gambia',
'GN' => 'Guinea',
'GP' => 'Guadeloupe',
'GQ' => 'Equatorial Guinea',
'GR' => 'Greece',
'GS' => 'South Georgia and the South Sandwich Islands',
'GT' => 'Guatemala',
'GU' => 'Guam',
'GW' => 'Guinea-Bissau',
'GY' => 'Guyana',
'HK' => 'Hong Kong',
'HM' => 'Heard Island and McDonald Islands',
'HN' => 'Honduras',
'HR' => 'Croatia',
'HT' => 'Haiti',
'HU' => 'Hungary',
'ID' => 'Indonesia',
'IE' => 'Ireland',
'IL' => 'Israel',
'IM' => 'Isle of Man',
'IN' => 'India',
'IO' => 'British Indian Ocean Territory',
'IQ' => 'Iraq',
'IR' => 'Iran',
'IS' => 'Iceland',
'IT' => 'Italy',
'JE' => 'Jersey',
'JM' => 'Jamaica',
'JO' => 'Jordan',
'JP' => 'Japan',
'KE' => 'Kenya',
'KG' => 'Kyrgyzstan',
'KH' => 'Cambodia',
'KI' => 'Kiribati',
'KM' => 'Comoros',
'KN' => 'Saint Kitts and Nevis',
'KP' => 'Korea (Democratic People\'s Republic of)',
'KR' => 'Korea, Republic of',
'KW' => 'Kuwait',
'KY' => 'Cayman Islands',
'KZ' => 'Kazakhstan',
'LA' => 'Lao People\'s Democratic Republic',
'LB' => 'Lebanon',
'LC' => 'Saint Lucia',
'LI' => 'Liechtenstein',
'LK' => 'Sri Lanka',
'LR' => 'Liberia',
'LS' => 'Lesotho',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'LV' => 'Latvia',
'LY' => 'Libya',
'MA' => 'Morocco',
'MC' => 'Monaco',
'MD' => 'Moldova',
'ME' => 'Montenegro',
'MF' => 'Saint Martin (French part)',
'MG' => 'Madagascar',
'MH' => 'Marshall Islands',
'MK' => 'North Macedonia',
'ML' => 'Mali',
'MM' => 'Myanmar',
'MN' => 'Mongolia',
'MO' => 'Macao',
'MP' => 'Northern Mariana Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MS' => 'Montserrat',
'MT' => 'Malta',
'MU' => 'Mauritius',
'MV' => 'Maldives',
'MW' => 'Malawi',
'MX' => 'Mexico',
'MY' => 'Malaysia',
'MZ' => 'Mozambique',
'NA' => 'Namibia',
'NC' => 'New Caledonia',
'NE' => 'Niger',
'NF' => 'Norfolk Island',
'NG' => 'Nigeria',
'NI' => 'Nicaragua',
'NL' => 'Netherlands',
'NO' => 'Norway',
'NP' => 'Nepal',
'NR' => 'Nauru',
'NU' => 'Niue',
'NZ' => 'New Zealand',
'OM' => 'Oman',
'PA' => 'Panama',
'PE' => 'Peru',
'PF' => 'French Polynesia',
'PG' => 'Papua New Guinea',
'PH' => 'Philippines',
'PK' => 'Pakistan',
'PL' => 'Poland',
'PM' => 'Saint Pierre and Miquelon',
'PN' => 'Pitcairn',
'PR' => 'Puerto Rico',
'PS' => 'Palestine',
'PT' => 'Portugal',
'PW' => 'Palau',
'PY' => 'Paraguay',
'QA' => 'Qatar',
'RE' => 'Réunion',
'RO' => 'Romania',
'RS' => 'Serbia',
'RU' => 'Russian Federation',
'RW' => 'Rwanda',
'SA' => 'Saudi Arabia',
'SB' => 'Solomon Islands',
'SC' => 'Seychelles',
'SD' => 'Sudan',
'SE' => 'Sweden',
'SG' => 'Singapore',
'SH' => 'Saint Helena, Ascension and Tristan da Cunha',
'SI' => 'Slovenia',
'SJ' => 'Svalbard and Jan Mayen',
'SK' => 'Slovakia',
'SL' => 'Sierra Leone',
'SM' => 'San Marino',
'SN' => 'Senegal',
'SO' => 'Somalia',
'SR' => 'Suriname',
'SS' => 'South Sudan',
'ST' => 'Sao Tome and Principe',
'SV' => 'El Salvador',
'SX' => 'Sint Maarten (Dutch part)',
'SY' => 'Syrian Arab Republic',
'SZ' => 'Eswatini',
'TC' => 'Turks and Caicos Islands',
'TD' => 'Chad',
'TF' => 'French Southern Territories',
'TG' => 'Togo',
'TH' => 'Thailand',
'TJ' => 'Tajikistan',
'TK' => 'Tokelau',
'TL' => 'Timor-Leste',
'TM' => 'Turkmenistan',
'TN' => 'Tunisia',
'TO' => 'Tonga',
'TR' => 'Turkey',
'TT' => 'Trinidad and Tobago',
'TV' => 'Tuvalu',
'TW' => 'Taiwan',
'TZ' => 'Tanzania',
'UA' => 'Ukraine',
'UG' => 'Uganda',
'UM' => 'United States Minor Outlying Islands',
'US' => 'United States of America',
'UY' => 'Uruguay',
'UZ' => 'Uzbekistan',
'VA' => 'Holy See',
'VC' => 'Saint Vincent and the Grenadines',
'VE' => 'Venezuela',
'VG' => 'Virgin Islands (British)',
'VI' => 'Virgin Islands (U.S.)',
'VN' => 'Viet Nam',
'VU' => 'Vanuatu',
'WF' => 'Wallis and Futuna',
'WS' => 'Samoa',
'YE' => 'Yemen',
'YT' => 'Mayotte',
'ZA' => 'South Africa',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/zh_Hant.php | src/Carbon/Lang/zh_Hant.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Adam
* - monkeycon
* - François B
* - Jason Katz-Brown
* - Chris Lam
* - Serhan Apaydın
* - Gary Lo
* - JD Isaacks
* - Chris Hemp
* - Eddie
* - KID
* - shankesgk2
* - Daniel Cheung (danvim)
*/
return [
'year' => ':count:optional-space年',
'y' => ':count:optional-space年',
'month' => ':count:optional-space個月',
'm' => ':count:optional-space月',
'week' => ':count:optional-space週',
'w' => ':count:optional-space週',
'day' => ':count:optional-space天',
'd' => ':count:optional-space天',
'hour' => ':count:optional-space小時',
'h' => ':count:optional-space小時',
'minute' => ':count:optional-space分鐘',
'min' => ':count:optional-space分鐘',
'second' => ':count:optional-space秒',
'a_second' => '{1}幾秒|[-Inf,Inf]:count:optional-space秒',
's' => ':count:optional-space秒',
'ago' => ':time前',
'from_now' => ':time後',
'after' => ':time後',
'before' => ':time前',
'diff_now' => '現在',
'diff_today' => '今天',
'diff_yesterday' => '昨天',
'diff_tomorrow' => '明天',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'YYYY/MM/DD',
'LL' => 'YYYY年M月D日',
'LLL' => 'YYYY年M月D日 HH:mm',
'LLLL' => 'YYYY年M月D日dddd HH:mm',
],
'calendar' => [
'sameDay' => '[今天] LT',
'nextDay' => '[明天] LT',
'nextWeek' => '[下]dddd LT',
'lastDay' => '[昨天] LT',
'lastWeek' => '[上]dddd LT',
'sameElse' => 'L',
],
'ordinal' => static function ($number, $period) {
return match ($period) {
'd', 'D', 'DDD' => $number.'日',
'M' => $number.'月',
'w', 'W' => $number.'周',
default => $number,
};
},
'meridiem' => static function ($hour, $minute) {
$time = $hour * 100 + $minute;
if ($time < 600) {
return '凌晨';
}
if ($time < 900) {
return '早上';
}
if ($time < 1130) {
return '上午';
}
if ($time < 1230) {
return '中午';
}
if ($time < 1800) {
return '下午';
}
return '晚上';
},
'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
'months_short' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
'weekdays' => ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
'weekdays_short' => ['週日', '週一', '週二', '週三', '週四', '週五', '週六'],
'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => '',
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/eu_ES.php | src/Carbon/Lang/eu_ES.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/eu.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/miq.php | src/Carbon/Lang/miq.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/miq_NI.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/chr_US.php | src/Carbon/Lang/chr_US.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Cherokee Nation Joseph Erb josepherb7@gmail.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'MM/DD/YYYY',
],
'months' => ['ᎤᏃᎸᏔᏅ', 'ᎧᎦᎵ', 'ᎠᏅᏱ', 'ᎧᏬᏂ', 'ᎠᏂᏍᎬᏘ', 'ᏕᎭᎷᏱ', 'ᎫᏰᏉᏂ', 'ᎦᎶᏂ', 'ᏚᎵᏍᏗ', 'ᏚᏂᏅᏗ', 'ᏅᏓᏕᏆ', 'ᎥᏍᎩᏱ'],
'months_short' => ['ᎤᏃ', 'ᎧᎦ', 'ᎠᏅ', 'ᎧᏬ', 'ᎠᏂ', 'ᏕᎭ', 'ᎫᏰ', 'ᎦᎶ', 'ᏚᎵ', 'ᏚᏂ', 'ᏅᏓ', 'ᎥᏍ'],
'weekdays' => ['ᎤᎾᏙᏓᏆᏍᎬ', 'ᎤᎾᏙᏓᏉᏅᎯ', 'ᏔᎵᏁᎢᎦ', 'ᏦᎢᏁᎢᎦ', 'ᏅᎩᏁᎢᎦ', 'ᏧᎾᎩᎶᏍᏗ', 'ᎤᎾᏙᏓᏈᏕᎾ'],
'weekdays_short' => ['ᏆᏍᎬ', 'ᏉᏅᎯ', 'ᏔᎵᏁ', 'ᏦᎢᏁ', 'ᏅᎩᏁ', 'ᏧᎾᎩ', 'ᏈᏕᎾ'],
'weekdays_min' => ['ᏆᏍᎬ', 'ᏉᏅᎯ', 'ᏔᎵᏁ', 'ᏦᎢᏁ', 'ᏅᎩᏁ', 'ᏧᎾᎩ', 'ᏈᏕᎾ'],
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
'meridiem' => ['ᏌᎾᎴ', 'ᏒᎯᏱᎢᏗᏢ', 'ꮜꮎꮄ', 'ꮢꭿᏹꭲꮧꮲ'],
'second' => ':count ᏐᎢ', // less reliable
's' => ':count ᏐᎢ', // less reliable
'a_second' => ':count ᏐᎢ', // less reliable
'year' => ':count ᏑᏕᏘᏴᏓ',
'y' => ':count ᏑᏕᏘᏴᏓ',
'a_year' => ':count ᏑᏕᏘᏴᏓ',
'month' => ':count ᏏᏅᏙ',
'm' => ':count ᏏᏅᏙ',
'a_month' => ':count ᏏᏅᏙ',
'week' => ':count ᏑᎾᏙᏓᏆᏍᏗ',
'w' => ':count ᏑᎾᏙᏓᏆᏍᏗ',
'a_week' => ':count ᏑᎾᏙᏓᏆᏍᏗ',
'day' => ':count ᎢᎦ',
'd' => ':count ᎢᎦ',
'a_day' => ':count ᎢᎦ',
'hour' => ':count ᏑᏟᎶᏛ',
'h' => ':count ᏑᏟᎶᏛ',
'a_hour' => ':count ᏑᏟᎶᏛ',
'minute' => ':count ᎢᏯᏔᏬᏍᏔᏅ',
'min' => ':count ᎢᏯᏔᏬᏍᏔᏅ',
'a_minute' => ':count ᎢᏯᏔᏬᏍᏔᏅ',
'ago' => ':time ᏥᎨᏒ',
'from_now' => 'ᎾᎿ :time',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/it.php | src/Carbon/Lang/it.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Ash
* - François B
* - Marco Perrando
* - Massimiliano Caniparoli
* - JD Isaacks
* - Andrea Martini
* - Francesco Marasco
* - Tizianoz93
* - Davide Casiraghi (davide-casiraghi)
* - Pete Scopes (pdscopes)
*/
use Carbon\CarbonInterface;
return [
'year' => ':count anno|:count anni',
'a_year' => 'un anno|:count anni',
'y' => ':count anno|:count anni',
'month' => ':count mese|:count mesi',
'a_month' => 'un mese|:count mesi',
'm' => ':count mese|:count mesi',
'week' => ':count settimana|:count settimane',
'a_week' => 'una settimana|:count settimane',
'w' => ':count set.',
'day' => ':count giorno|:count giorni',
'a_day' => 'un giorno|:count giorni',
'd' => ':count g|:count gg',
'hour' => ':count ora|:count ore',
'a_hour' => 'un\'ora|:count ore',
'h' => ':count h',
'minute' => ':count minuto|:count minuti',
'a_minute' => 'un minuto|:count minuti',
'min' => ':count min.',
'second' => ':count secondo|:count secondi',
'a_second' => 'alcuni secondi|:count secondi',
's' => ':count sec.',
'millisecond' => ':count millisecondo|:count millisecondi',
'a_millisecond' => 'un millisecondo|:count millisecondi',
'ms' => ':countms',
'microsecond' => ':count microsecondo|:count microsecondi',
'a_microsecond' => 'un microsecondo|:count microsecondi',
'µs' => ':countµs',
'ago' => ':time fa',
'from_now' => static function ($time) {
return (preg_match('/^\d.+$/', $time) ? 'tra' : 'in')." $time";
},
'after' => ':time dopo',
'before' => ':time prima',
'diff_now' => 'proprio ora',
'diff_today' => 'Oggi',
'diff_today_regexp' => 'Oggi(?:\\s+alle)?',
'diff_yesterday' => 'ieri',
'diff_yesterday_regexp' => 'Ieri(?:\\s+alle)?',
'diff_tomorrow' => 'domani',
'diff_tomorrow_regexp' => 'Domani(?:\\s+alle)?',
'diff_before_yesterday' => 'l\'altro ieri',
'diff_after_tomorrow' => 'dopodomani',
'period_interval' => 'ogni :interval',
'period_start_date' => 'dal :date',
'period_end_date' => 'al :date',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd D MMMM YYYY HH:mm',
],
'calendar' => [
'sameDay' => '[Oggi alle] LT',
'nextDay' => '[Domani alle] LT',
'nextWeek' => 'dddd [alle] LT',
'lastDay' => '[Ieri alle] LT',
'lastWeek' => static fn (CarbonInterface $date) => match ($date->dayOfWeek) {
0 => '[la scorsa] dddd [alle] LT',
default => '[lo scorso] dddd [alle] LT',
},
'sameElse' => 'L',
],
'ordinal' => ':numberº',
'months' => ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'],
'months_short' => ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
'weekdays' => ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'],
'weekdays_short' => ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
'weekdays_min' => ['do', 'lu', 'ma', 'me', 'gi', 've', 'sa'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => [', ', ' e '],
'ordinal_words' => [
'of' => 'di',
'first' => 'primo',
'second' => 'secondo',
'third' => 'terzo',
'fourth' => 'quarto',
'fifth' => 'quinto',
'last' => 'ultimo',
],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/kde.php | src/Carbon/Lang/kde.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'meridiem' => ['Muhi', 'Chilo'],
'weekdays' => ['Liduva lyapili', 'Liduva lyatatu', 'Liduva lyanchechi', 'Liduva lyannyano', 'Liduva lyannyano na linji', 'Liduva lyannyano na mavili', 'Liduva litandi'],
'weekdays_short' => ['Ll2', 'Ll3', 'Ll4', 'Ll5', 'Ll6', 'Ll7', 'Ll1'],
'weekdays_min' => ['Ll2', 'Ll3', 'Ll4', 'Ll5', 'Ll6', 'Ll7', 'Ll1'],
'months' => ['Mwedi Ntandi', 'Mwedi wa Pili', 'Mwedi wa Tatu', 'Mwedi wa Nchechi', 'Mwedi wa Nnyano', 'Mwedi wa Nnyano na Umo', 'Mwedi wa Nnyano na Mivili', 'Mwedi wa Nnyano na Mitatu', 'Mwedi wa Nnyano na Nchechi', 'Mwedi wa Nnyano na Nnyano', 'Mwedi wa Nnyano na Nnyano na U', 'Mwedi wa Nnyano na Nnyano na M'],
'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'],
'first_day_of_week' => 1,
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd, D MMMM YYYY HH:mm',
],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_TO.php | src/Carbon/Lang/en_TO.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/aa.php | src/Carbon/Lang/aa.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/aa_DJ.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_GD.php | src/Carbon/Lang/en_GD.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/haw.php | src/Carbon/Lang/haw.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
'months' => ['Ianuali', 'Pepeluali', 'Malaki', 'ʻApelila', 'Mei', 'Iune', 'Iulai', 'ʻAukake', 'Kepakemapa', 'ʻOkakopa', 'Nowemapa', 'Kekemapa'],
'months_short' => ['Ian.', 'Pep.', 'Mal.', 'ʻAp.', 'Mei', 'Iun.', 'Iul.', 'ʻAu.', 'Kep.', 'ʻOk.', 'Now.', 'Kek.'],
'weekdays' => ['Lāpule', 'Poʻakahi', 'Poʻalua', 'Poʻakolu', 'Poʻahā', 'Poʻalima', 'Poʻaono'],
'weekdays_short' => ['LP', 'P1', 'P2', 'P3', 'P4', 'P5', 'P6'],
'weekdays_min' => ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
'formats' => [
'LT' => 'h:mm a',
'LTS' => 'h:mm:ss a',
'L' => 'D/M/YYYY',
'LL' => 'D MMM YYYY',
'LLL' => 'D MMMM YYYY h:mm a',
'LLLL' => 'dddd, D MMMM YYYY h:mm a',
],
'year' => ':count makahiki',
'y' => ':count makahiki',
'a_year' => ':count makahiki',
'month' => ':count mahina',
'm' => ':count mahina',
'a_month' => ':count mahina',
'week' => ':count pule',
'w' => ':count pule',
'a_week' => ':count pule',
'day' => ':count lā',
'd' => ':count lā',
'a_day' => ':count lā',
'hour' => ':count hola',
'h' => ':count hola',
'a_hour' => ':count hola',
'minute' => ':count minuke',
'min' => ':count minuke',
'a_minute' => ':count minuke',
'second' => ':count lua',
's' => ':count lua',
'a_second' => ':count lua',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/sah_RU.php | src/Carbon/Lang/sah_RU.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Valery Timiriliyev Valery Timiriliyev timiriliyev@gmail.com
*/
return array_replace_recursive(require __DIR__.'/ru.php', [
'formats' => [
'L' => 'YYYY.MM.DD',
],
'months' => ['тохсунньу', 'олунньу', 'кулун тутар', 'муус устар', 'ыам ыйын', 'бэс ыйын', 'от ыйын', 'атырдьах ыйын', 'балаҕан ыйын', 'алтынньы', 'сэтинньи', 'ахсынньы'],
'months_short' => ['тохс', 'олун', 'кул', 'муус', 'ыам', 'бэс', 'от', 'атыр', 'бал', 'алт', 'сэт', 'ахс'],
'weekdays' => ['баскыһыанньа', 'бэнидиэнньик', 'оптуорунньук', 'сэрэдэ', 'чэппиэр', 'бээтинсэ', 'субуота'],
'weekdays_short' => ['бс', 'бн', 'оп', 'ср', 'чп', 'бт', 'сб'],
'weekdays_min' => ['бс', 'бн', 'оп', 'ср', 'чп', 'бт', 'сб'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 1,
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ff_GN.php | src/Carbon/Lang/ff_GN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/ff.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/bs_Cyrl.php | src/Carbon/Lang/bs_Cyrl.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/bs.php', [
'meridiem' => ['пре подне', 'поподне'],
'weekdays' => ['недјеља', 'понедјељак', 'уторак', 'сриједа', 'четвртак', 'петак', 'субота'],
'weekdays_short' => ['нед', 'пон', 'уто', 'сри', 'чет', 'пет', 'суб'],
'weekdays_min' => ['нед', 'пон', 'уто', 'сри', 'чет', 'пет', 'суб'],
'months' => ['јануар', 'фебруар', 'март', 'април', 'мај', 'јуни', 'јули', 'аугуст', 'септембар', 'октобар', 'новембар', 'децембар'],
'months_short' => ['јан', 'феб', 'мар', 'апр', 'мај', 'јун', 'јул', 'ауг', 'сеп', 'окт', 'нов', 'дец'],
'first_day_of_week' => 1,
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'D.M.YYYY.',
'LL' => 'DD.MM.YYYY.',
'LLL' => 'DD. MMMM YYYY. HH:mm',
'LLLL' => 'dddd, DD. MMMM YYYY. HH:mm',
],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/kl_GL.php | src/Carbon/Lang/kl_GL.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Danish Standards Association bug-glibc-locales@gnu.org
* - John Eyðstein Johannesen (mashema)
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD.MM.YYYY',
'LL' => 'D. MMMM YYYY',
'LLL' => 'D. MMMM YYYY HH:mm',
'LLLL' => 'dddd [d.] D. MMMM YYYY [kl.] HH:mm',
],
'months' => ['januaarip', 'februaarip', 'marsip', 'apriilip', 'maajip', 'juunip', 'juulip', 'aggustip', 'septembarip', 'oktobarip', 'novembarip', 'decembarip'],
'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
'weekdays' => ['sapaat', 'ataasinngorneq', 'marlunngorneq', 'pingasunngorneq', 'sisamanngorneq', 'tallimanngorneq', 'arfininngorneq'],
'weekdays_short' => ['sap', 'ata', 'mar', 'pin', 'sis', 'tal', 'arf'],
'weekdays_min' => ['sap', 'ata', 'mar', 'pin', 'sis', 'tal', 'arf'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 1,
'year' => '{1}ukioq :count|{0}:count ukiut|[-Inf,Inf]ukiut :count',
'a_year' => '{1}ukioq|{0}:count ukiut|[-Inf,Inf]ukiut :count',
'y' => '{1}:countyr|{0}:countyrs|[-Inf,Inf]:countyrs',
'month' => '{1}qaammat :count|{0}:count qaammatit|[-Inf,Inf]qaammatit :count',
'a_month' => '{1}qaammat|{0}:count qaammatit|[-Inf,Inf]qaammatit :count',
'm' => '{1}:countmo|{0}:countmos|[-Inf,Inf]:countmos',
'week' => '{1}:count sap. ak.|{0}:count sap. ak.|[-Inf,Inf]:count sap. ak.',
'a_week' => '{1}a sap. ak.|{0}:count sap. ak.|[-Inf,Inf]:count sap. ak.',
'w' => ':countw',
'day' => '{1}:count ulloq|{0}:count ullut|[-Inf,Inf]:count ullut',
'a_day' => '{1}a ulloq|{0}:count ullut|[-Inf,Inf]:count ullut',
'd' => ':countd',
'hour' => '{1}:count tiimi|{0}:count tiimit|[-Inf,Inf]:count tiimit',
'a_hour' => '{1}tiimi|{0}:count tiimit|[-Inf,Inf]:count tiimit',
'h' => ':counth',
'minute' => '{1}:count minutsi|{0}:count minutsit|[-Inf,Inf]:count minutsit',
'a_minute' => '{1}a minutsi|{0}:count minutsit|[-Inf,Inf]:count minutsit',
'min' => ':countm',
'second' => '{1}:count sikunti|{0}:count sikuntit|[-Inf,Inf]:count sikuntit',
'a_second' => '{1}sikunti|{0}:count sikuntit|[-Inf,Inf]:count sikuntit',
's' => ':counts',
'ago' => ':time matuma siorna',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/niu.php | src/Carbon/Lang/niu.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/niu_NU.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/nds_DE.php | src/Carbon/Lang/nds_DE.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - information from Kenneth Christiansen Kenneth Christiansen, Pablo Saratxaga kenneth@gnu.org, pablo@mandrakesoft.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'DD.MM.YYYY',
],
'months' => ['Jannuaar', 'Feberwaar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
'months_short' => ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
'weekdays' => ['Sünndag', 'Maandag', 'Dingsdag', 'Middeweek', 'Dunnersdag', 'Freedag', 'Sünnavend'],
'weekdays_short' => ['Sdag', 'Maan', 'Ding', 'Midd', 'Dunn', 'Free', 'Svd.'],
'weekdays_min' => ['Sd', 'Ma', 'Di', 'Mi', 'Du', 'Fr', 'Sa'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'year' => ':count Johr',
'y' => ':countJ',
'a_year' => '{1}een Johr|:count Johr',
'month' => ':count Maand',
'm' => ':countM',
'a_month' => '{1}een Maand|:count Maand',
'week' => ':count Week|:count Weken',
'w' => ':countW',
'a_week' => '{1}een Week|:count Week|:count Weken',
'day' => ':count Dag|:count Daag',
'd' => ':countD',
'a_day' => '{1}een Dag|:count Dag|:count Daag',
'hour' => ':count Stünn|:count Stünnen',
'h' => ':countSt',
'a_hour' => '{1}een Stünn|:count Stünn|:count Stünnen',
'minute' => ':count Minuut|:count Minuten',
'min' => ':countm',
'a_minute' => '{1}een Minuut|:count Minuut|:count Minuten',
'second' => ':count Sekunn|:count Sekunnen',
's' => ':counts',
'a_second' => 'en poor Sekunnen|:count Sekunn|:count Sekunnen',
'ago' => 'vör :time',
'from_now' => 'in :time',
'before' => ':time vörher',
'after' => ':time later',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/tpi_PG.php | src/Carbon/Lang/tpi_PG.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'DD/MM/YYYY',
],
'months' => ['Janueri', 'Februeri', 'Mas', 'Epril', 'Me', 'Jun', 'Julai', 'Ogas', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'],
'months_short' => ['Jan', 'Feb', 'Mas', 'Epr', 'Me', 'Jun', 'Jul', 'Oga', 'Sep', 'Okt', 'Nov', 'Des'],
'weekdays' => ['Sande', 'Mande', 'Tunde', 'Trinde', 'Fonde', 'Fraide', 'Sarere'],
'weekdays_short' => ['San', 'Man', 'Tun', 'Tri', 'Fon', 'Fra', 'Sar'],
'weekdays_min' => ['San', 'Man', 'Tun', 'Tri', 'Fon', 'Fra', 'Sar'],
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
'meridiem' => ['biknait', 'apinun'],
'year' => 'yia :count',
'y' => 'yia :count',
'a_year' => 'yia :count',
'month' => ':count mun',
'm' => ':count mun',
'a_month' => ':count mun',
'week' => ':count wik',
'w' => ':count wik',
'a_week' => ':count wik',
'day' => ':count de',
'd' => ':count de',
'a_day' => ':count de',
'hour' => ':count aua',
'h' => ':count aua',
'a_hour' => ':count aua',
'minute' => ':count minit',
'min' => ':count minit',
'a_minute' => ':count minit',
'second' => ':count namba tu',
's' => ':count namba tu',
'a_second' => ':count namba tu',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ff_SN.php | src/Carbon/Lang/ff_SN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Pular-Fulfulde.org Ibrahima Sarr admin@pulaar-fulfulde.org
*/
return require __DIR__.'/ff.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/fr_HT.php | src/Carbon/Lang/fr_HT.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/fr.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ar_AE.php | src/Carbon/Lang/ar_AE.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org
* - Abdullah-Alhariri
*/
return array_replace_recursive(require __DIR__.'/ar.php', [
'formats' => [
'L' => 'DD MMM, YYYY',
],
'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'],
'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت '],
'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
'first_day_of_week' => 6,
'day_of_first_week_of_year' => 1,
'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_BW.php | src/Carbon/Lang/en_BW.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ss.php | src/Carbon/Lang/ss.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - François B
* - Nicolai Davies
*/
return [
'year' => '{1}umnyaka|:count iminyaka',
'month' => '{1}inyanga|:count tinyanga',
'week' => '{1}:count liviki|:count emaviki',
'day' => '{1}lilanga|:count emalanga',
'hour' => '{1}lihora|:count emahora',
'minute' => '{1}umzuzu|:count emizuzu',
'second' => '{1}emizuzwana lomcane|:count mzuzwana',
'ago' => 'wenteka nga :time',
'from_now' => 'nga :time',
'diff_yesterday' => 'Itolo',
'diff_yesterday_regexp' => 'Itolo(?:\\s+nga)?',
'diff_today' => 'Namuhla',
'diff_today_regexp' => 'Namuhla(?:\\s+nga)?',
'diff_tomorrow' => 'Kusasa',
'diff_tomorrow_regexp' => 'Kusasa(?:\\s+nga)?',
'formats' => [
'LT' => 'h:mm A',
'LTS' => 'h:mm:ss A',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMMM YYYY',
'LLL' => 'D MMMM YYYY h:mm A',
'LLLL' => 'dddd, D MMMM YYYY h:mm A',
],
'calendar' => [
'sameDay' => '[Namuhla nga] LT',
'nextDay' => '[Kusasa nga] LT',
'nextWeek' => 'dddd [nga] LT',
'lastDay' => '[Itolo nga] LT',
'lastWeek' => 'dddd [leliphelile] [nga] LT',
'sameElse' => 'L',
],
'ordinal' => static function ($number) {
$lastDigit = $number % 10;
return $number.(
((int) ($number % 100 / 10) === 1) ? 'e' : (
($lastDigit === 1 || $lastDigit === 2) ? 'a' : 'e'
)
);
},
'meridiem' => static function ($hour) {
if ($hour < 11) {
return 'ekuseni';
}
if ($hour < 15) {
return 'emini';
}
if ($hour < 19) {
return 'entsambama';
}
return 'ebusuku';
},
'months' => ['Bhimbidvwane', 'Indlovana', 'Indlov\'lenkhulu', 'Mabasa', 'Inkhwekhweti', 'Inhlaba', 'Kholwane', 'Ingci', 'Inyoni', 'Imphala', 'Lweti', 'Ingongoni'],
'months_short' => ['Bhi', 'Ina', 'Inu', 'Mab', 'Ink', 'Inh', 'Kho', 'Igc', 'Iny', 'Imp', 'Lwe', 'Igo'],
'weekdays' => ['Lisontfo', 'Umsombuluko', 'Lesibili', 'Lesitsatfu', 'Lesine', 'Lesihlanu', 'Umgcibelo'],
'weekdays_short' => ['Lis', 'Umb', 'Lsb', 'Les', 'Lsi', 'Lsh', 'Umg'],
'weekdays_min' => ['Li', 'Us', 'Lb', 'Lt', 'Ls', 'Lh', 'Ug'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/so_DJ.php | src/Carbon/Lang/so_DJ.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Ge'ez Frontier Foundation locales@geez.org
*/
return array_replace_recursive(require __DIR__.'/so.php', [
'formats' => [
'L' => 'DD.MM.YYYY',
],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/tpi.php | src/Carbon/Lang/tpi.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/tpi_PG.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/hi_IN.php | src/Carbon/Lang/hi_IN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/hi.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_LR.php | src/Carbon/Lang/en_LR.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ar_JO.php | src/Carbon/Lang/ar_JO.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org
* - Abdullah-Alhariri
*/
return array_replace_recursive(require __DIR__.'/ar.php', [
'formats' => [
'L' => 'DD MMM, YYYY',
],
'months' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],
'months_short' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],
'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
'first_day_of_week' => 6,
'day_of_first_week_of_year' => 1,
'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ar_OM.php | src/Carbon/Lang/ar_OM.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org
* - Abdullah-Alhariri
*/
return array_replace_recursive(require __DIR__.'/ar.php', [
'formats' => [
'L' => 'DD MMM, YYYY',
],
'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'],
'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'],
'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'],
'first_day_of_week' => 6,
'day_of_first_week_of_year' => 1,
'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/jv.php | src/Carbon/Lang/jv.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Josh Soref
* - tgfjt
* - JD Isaacks
*/
return [
'year' => ':count taun',
'a_year' => '{1}setaun|[-Inf,Inf]:count taun',
'month' => ':count wulan',
'a_month' => '{1}sewulan|[-Inf,Inf]:count wulan',
'week' => ':count minggu',
'a_week' => '{1}sakminggu|[-Inf,Inf]:count minggu',
'day' => ':count dina',
'a_day' => '{1}sedina|[-Inf,Inf]:count dina',
'hour' => ':count jam',
'a_hour' => '{1}setunggal jam|[-Inf,Inf]:count jam',
'minute' => ':count menit',
'a_minute' => '{1}setunggal menit|[-Inf,Inf]:count menit',
'second' => ':count detik',
'a_second' => '{0,1}sawetawis detik|[-Inf,Inf]:count detik',
'ago' => ':time ingkang kepengker',
'from_now' => 'wonten ing :time',
'diff_today' => 'Dinten',
'diff_yesterday' => 'Kala',
'diff_yesterday_regexp' => 'Kala(?:\\s+wingi)?(?:\\s+pukul)?',
'diff_tomorrow' => 'Mbenjang',
'diff_tomorrow_regexp' => 'Mbenjang(?:\\s+pukul)?',
'diff_today_regexp' => 'Dinten(?:\\s+puniko)?(?:\\s+pukul)?',
'formats' => [
'LT' => 'HH.mm',
'LTS' => 'HH.mm.ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMMM YYYY',
'LLL' => 'D MMMM YYYY [pukul] HH.mm',
'LLLL' => 'dddd, D MMMM YYYY [pukul] HH.mm',
],
'calendar' => [
'sameDay' => '[Dinten puniko pukul] LT',
'nextDay' => '[Mbenjang pukul] LT',
'nextWeek' => 'dddd [pukul] LT',
'lastDay' => '[Kala wingi pukul] LT',
'lastWeek' => 'dddd [kepengker pukul] LT',
'sameElse' => 'L',
],
'meridiem' => static function ($hour) {
if ($hour < 11) {
return 'enjing';
}
if ($hour < 15) {
return 'siyang';
}
if ($hour < 19) {
return 'sonten';
}
return 'ndalu';
},
'months' => ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'],
'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'],
'weekdays' => ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'],
'weekdays_short' => ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'],
'weekdays_min' => ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 1,
'list' => [', ', ' lan '],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/mer.php | src/Carbon/Lang/mer.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
'meridiem' => ['RŨ', 'ŨG'],
'weekdays' => ['Kiumia', 'Muramuko', 'Wairi', 'Wethatu', 'Wena', 'Wetano', 'Jumamosi'],
'weekdays_short' => ['KIU', 'MRA', 'WAI', 'WET', 'WEN', 'WTN', 'JUM'],
'weekdays_min' => ['KIU', 'MRA', 'WAI', 'WET', 'WEN', 'WTN', 'JUM'],
'months' => ['Januarĩ', 'Feburuarĩ', 'Machi', 'Ĩpurũ', 'Mĩĩ', 'Njuni', 'Njuraĩ', 'Agasti', 'Septemba', 'Oktũba', 'Novemba', 'Dicemba'],
'months_short' => ['JAN', 'FEB', 'MAC', 'ĨPU', 'MĨĨ', 'NJU', 'NJR', 'AGA', 'SPT', 'OKT', 'NOV', 'DEC'],
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd, D MMMM YYYY HH:mm',
],
'year' => ':count murume', // less reliable
'y' => ':count murume', // less reliable
'a_year' => ':count murume', // less reliable
'month' => ':count muchaara', // less reliable
'm' => ':count muchaara', // less reliable
'a_month' => ':count muchaara', // less reliable
'minute' => ':count monto', // less reliable
'min' => ':count monto', // less reliable
'a_minute' => ':count monto', // less reliable
'second' => ':count gikeno', // less reliable
's' => ':count gikeno', // less reliable
'a_second' => ':count gikeno', // less reliable
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/gl.php | src/Carbon/Lang/gl.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - François B
* - Fidel Pita
* - JD Isaacks
* - Diego Vilariño
* - Sebastian Thierer
*/
use Carbon\CarbonInterface;
return [
'year' => ':count ano|:count anos',
'a_year' => 'un ano|:count anos',
'y' => ':count a.',
'month' => ':count mes|:count meses',
'a_month' => 'un mes|:count meses',
'm' => ':count mes.',
'week' => ':count semana|:count semanas',
'a_week' => 'unha semana|:count semanas',
'w' => ':count sem.',
'day' => ':count día|:count días',
'a_day' => 'un día|:count días',
'd' => ':count d.',
'hour' => ':count hora|:count horas',
'a_hour' => 'unha hora|:count horas',
'h' => ':count h.',
'minute' => ':count minuto|:count minutos',
'a_minute' => 'un minuto|:count minutos',
'min' => ':count min.',
'second' => ':count segundo|:count segundos',
'a_second' => 'uns segundos|:count segundos',
's' => ':count seg.',
'ago' => 'hai :time',
'from_now' => static function ($time) {
if (str_starts_with($time, 'un')) {
return "n$time";
}
return "en $time";
},
'diff_now' => 'agora',
'diff_today' => 'hoxe',
'diff_today_regexp' => 'hoxe(?:\\s+ás)?',
'diff_yesterday' => 'onte',
'diff_yesterday_regexp' => 'onte(?:\\s+á)?',
'diff_tomorrow' => 'mañá',
'diff_tomorrow_regexp' => 'mañá(?:\\s+ás)?',
'after' => ':time despois',
'before' => ':time antes',
'formats' => [
'LT' => 'H:mm',
'LTS' => 'H:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D [de] MMMM [de] YYYY',
'LLL' => 'D [de] MMMM [de] YYYY H:mm',
'LLLL' => 'dddd, D [de] MMMM [de] YYYY H:mm',
],
'calendar' => [
'sameDay' => static function (CarbonInterface $current) {
return '[hoxe '.($current->hour !== 1 ? 'ás' : 'á').'] LT';
},
'nextDay' => static function (CarbonInterface $current) {
return '[mañá '.($current->hour !== 1 ? 'ás' : 'á').'] LT';
},
'nextWeek' => static function (CarbonInterface $current) {
return 'dddd ['.($current->hour !== 1 ? 'ás' : 'á').'] LT';
},
'lastDay' => static function (CarbonInterface $current) {
return '[onte '.($current->hour !== 1 ? 'á' : 'a').'] LT';
},
'lastWeek' => static function (CarbonInterface $current) {
return '[o] dddd [pasado '.($current->hour !== 1 ? 'ás' : 'á').'] LT';
},
'sameElse' => 'L',
],
'ordinal' => ':numberº',
'months' => ['xaneiro', 'febreiro', 'marzo', 'abril', 'maio', 'xuño', 'xullo', 'agosto', 'setembro', 'outubro', 'novembro', 'decembro'],
'months_short' => ['xan.', 'feb.', 'mar.', 'abr.', 'mai.', 'xuñ.', 'xul.', 'ago.', 'set.', 'out.', 'nov.', 'dec.'],
'weekdays' => ['domingo', 'luns', 'martes', 'mércores', 'xoves', 'venres', 'sábado'],
'weekdays_short' => ['dom.', 'lun.', 'mar.', 'mér.', 'xov.', 'ven.', 'sáb.'],
'weekdays_min' => ['do', 'lu', 'ma', 'mé', 'xo', 've', 'sá'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => [', ', ' e '],
'meridiem' => ['a.m.', 'p.m.'],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/gez.php | src/Carbon/Lang/gez.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/gez_ER.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/bi_VU.php | src/Carbon/Lang/bi_VU.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com & maninder1.s@samsung.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
'formats' => [
'L' => 'dddd DD MMM YYYY',
],
'months' => ['jenuware', 'febwari', 'maj', 'epril', 'mei', 'jun', 'julae', 'ogis', 'septemba', 'oktoba', 'novemba', 'disemba'],
'months_short' => ['jen', 'feb', 'maj', 'epr', 'mei', 'jun', 'jul', 'ogi', 'sep', 'okt', 'nov', 'dis'],
'weekdays' => ['sande', 'mande', 'maj', 'wota', 'fraede', 'sarede'],
'weekdays_short' => ['san', 'man', 'maj', 'wot', 'fra', 'sar'],
'weekdays_min' => ['san', 'man', 'maj', 'wot', 'fra', 'sar'],
'year' => ':count seven', // less reliable
'y' => ':count seven', // less reliable
'a_year' => ':count seven', // less reliable
'month' => ':count mi', // less reliable
'm' => ':count mi', // less reliable
'a_month' => ':count mi', // less reliable
'week' => ':count sarede', // less reliable
'w' => ':count sarede', // less reliable
'a_week' => ':count sarede', // less reliable
'day' => ':count betde', // less reliable
'd' => ':count betde', // less reliable
'a_day' => ':count betde', // less reliable
'hour' => ':count klok', // less reliable
'h' => ':count klok', // less reliable
'a_hour' => ':count klok', // less reliable
'minute' => ':count smol', // less reliable
'min' => ':count smol', // less reliable
'a_minute' => ':count smol', // less reliable
'second' => ':count tu', // less reliable
's' => ':count tu', // less reliable
'a_second' => ':count tu', // less reliable
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/zh_Hans_HK.php | src/Carbon/Lang/zh_Hans_HK.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/zh_Hans.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/cmn_TW.php | src/Carbon/Lang/cmn_TW.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - bug-glibc-locales@gnu.org
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
'formats' => [
'L' => 'YYYY年MM月DD號',
],
'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
'months_short' => [' 1月', ' 2月', ' 3月', ' 4月', ' 5月', ' 6月', ' 7月', ' 8月', ' 9月', '10月', '11月', '12月'],
'weekdays' => ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
'weekdays_short' => ['日', '一', '二', '三', '四', '五', '六'],
'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'],
'meridiem' => ['上午', '下午'],
'year' => ':count 年',
'y' => ':count 年',
'a_year' => ':count 年',
'month' => ':count 月',
'm' => ':count 月',
'a_month' => ':count 月',
'week' => ':count 周',
'w' => ':count 周',
'a_week' => ':count 周',
'day' => ':count 白天',
'd' => ':count 白天',
'a_day' => ':count 白天',
'hour' => ':count 小时',
'h' => ':count 小时',
'a_hour' => ':count 小时',
'minute' => ':count 分钟',
'min' => ':count 分钟',
'a_minute' => ':count 分钟',
'second' => ':count 秒',
's' => ':count 秒',
'a_second' => ':count 秒',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/zh_YUE.php | src/Carbon/Lang/zh_YUE.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org
*/
return array_replace_recursive(require __DIR__.'/zh.php', [
'formats' => [
'L' => 'YYYY-MM-DD',
],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ky.php | src/Carbon/Lang/ky.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - acutexyz
* - Josh Soref
* - François B
* - Chyngyz Arystan uulu
* - Chyngyz
* - acutexyz
* - Josh Soref
* - François B
* - Chyngyz Arystan uulu
*/
return [
'year' => ':count жыл',
'a_year' => '{1}бир жыл|:count жыл',
'y' => ':count жыл',
'month' => ':count ай',
'a_month' => '{1}бир ай|:count ай',
'm' => ':count ай',
'week' => ':count апта',
'a_week' => '{1}бир апта|:count апта',
'w' => ':count апт.',
'day' => ':count күн',
'a_day' => '{1}бир күн|:count күн',
'd' => ':count күн',
'hour' => ':count саат',
'a_hour' => '{1}бир саат|:count саат',
'h' => ':count саат.',
'minute' => ':count мүнөт',
'a_minute' => '{1}бир мүнөт|:count мүнөт',
'min' => ':count мүн.',
'second' => ':count секунд',
'a_second' => '{1}бирнече секунд|:count секунд',
's' => ':count сек.',
'ago' => ':time мурун',
'from_now' => ':time ичинде',
'diff_now' => 'азыр',
'diff_today' => 'Бүгүн',
'diff_today_regexp' => 'Бүгүн(?:\\s+саат)?',
'diff_yesterday' => 'кечээ',
'diff_yesterday_regexp' => 'Кече(?:\\s+саат)?',
'diff_tomorrow' => 'эртең',
'diff_tomorrow_regexp' => 'Эртең(?:\\s+саат)?',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD.MM.YYYY',
'LL' => 'D MMMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd, D MMMM YYYY HH:mm',
],
'calendar' => [
'sameDay' => '[Бүгүн саат] LT',
'nextDay' => '[Эртең саат] LT',
'nextWeek' => 'dddd [саат] LT',
'lastDay' => '[Кече саат] LT',
'lastWeek' => '[Өткен аптанын] dddd [күнү] [саат] LT',
'sameElse' => 'L',
],
'ordinal' => static function ($number) {
static $suffixes = [
0 => '-чү',
1 => '-чи',
2 => '-чи',
3 => '-чү',
4 => '-чү',
5 => '-чи',
6 => '-чы',
7 => '-чи',
8 => '-чи',
9 => '-чу',
10 => '-чу',
20 => '-чы',
30 => '-чу',
40 => '-чы',
50 => '-чү',
60 => '-чы',
70 => '-чи',
80 => '-чи',
90 => '-чу',
100 => '-чү',
];
return $number.($suffixes[$number] ?? $suffixes[$number % 10] ?? $suffixes[$number >= 100 ? 100 : -1] ?? '');
},
'months' => ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
'months_short' => ['янв', 'фев', 'март', 'апр', 'май', 'июнь', 'июль', 'авг', 'сен', 'окт', 'ноя', 'дек'],
'weekdays' => ['Жекшемби', 'Дүйшөмбү', 'Шейшемби', 'Шаршемби', 'Бейшемби', 'Жума', 'Ишемби'],
'weekdays_short' => ['Жек', 'Дүй', 'Шей', 'Шар', 'Бей', 'Жум', 'Ише'],
'weekdays_min' => ['Жк', 'Дй', 'Шй', 'Шр', 'Бй', 'Жм', 'Иш'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 1,
'list' => ' ',
'meridiem' => ['таңкы', 'түштөн кийинки'],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_ER.php | src/Carbon/Lang/en_ER.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/de_AT.php | src/Carbon/Lang/de_AT.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - sheriffmarley
* - Timo
* - Michael Hohl
* - Namoshek
* - Bernhard Baumrock (BernhardBaumrock)
*/
return array_replace_recursive(require __DIR__.'/de.php', [
'months' => [
0 => 'Jänner',
],
'months_short' => [
0 => 'Jän',
],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/fr_VU.php | src/Carbon/Lang/fr_VU.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/fr.php', [
'formats' => [
'LT' => 'h:mm a',
'LTS' => 'h:mm:ss a',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMM YYYY',
'LLL' => 'D MMMM YYYY h:mm a',
'LLLL' => 'dddd D MMMM YYYY h:mm a',
],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/nds.php | src/Carbon/Lang/nds.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/nds_DE.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_VG.php | src/Carbon/Lang/en_VG.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/yi.php | src/Carbon/Lang/yi.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/yi_US.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_MY.php | src/Carbon/Lang/en_MY.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ca_IT.php | src/Carbon/Lang/ca_IT.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/ca.php', [
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/hif_FJ.php | src/Carbon/Lang/hif_FJ.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
'formats' => [
'L' => 'dddd DD MMM YYYY',
],
'months' => ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
'weekdays' => ['Ravivar', 'Somvar', 'Mangalvar', 'Budhvar', 'Guruvar', 'Shukravar', 'Shanivar'],
'weekdays_short' => ['Ravi', 'Som', 'Mangal', 'Budh', 'Guru', 'Shukra', 'Shani'],
'weekdays_min' => ['Ravi', 'Som', 'Mangal', 'Budh', 'Guru', 'Shukra', 'Shani'],
'meridiem' => ['Purvahan', 'Aparaahna'],
'hour' => ':count minit', // less reliable
'h' => ':count minit', // less reliable
'a_hour' => ':count minit', // less reliable
'year' => ':count saal',
'y' => ':count saal',
'a_year' => ':count saal',
'month' => ':count Mahina',
'm' => ':count Mahina',
'a_month' => ':count Mahina',
'week' => ':count Hafta',
'w' => ':count Hafta',
'a_week' => ':count Hafta',
'day' => ':count Din',
'd' => ':count Din',
'a_day' => ':count Din',
'minute' => ':count Minit',
'min' => ':count Minit',
'a_minute' => ':count Minit',
'second' => ':count Second',
's' => ':count Second',
'a_second' => ':count Second',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/yuw_PG.php | src/Carbon/Lang/yuw_PG.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Information from native speakers Hannah Sarvasy nungon.localization@gmail.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'DD/MM/YY',
],
'months' => ['jenuari', 'febuari', 'mas', 'epril', 'mei', 'jun', 'julai', 'ögus', 'septemba', 'öktoba', 'nöwemba', 'diksemba'],
'months_short' => ['jen', 'feb', 'mas', 'epr', 'mei', 'jun', 'jul', 'ögu', 'sep', 'ökt', 'nöw', 'dis'],
'weekdays' => ['sönda', 'mönda', 'sinda', 'mitiwö', 'sogipbono', 'nenggo', 'söndanggie'],
'weekdays_short' => ['sön', 'mön', 'sin', 'mit', 'soi', 'nen', 'sab'],
'weekdays_min' => ['sön', 'mön', 'sin', 'mit', 'soi', 'nen', 'sab'],
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/es_CO.php | src/Carbon/Lang/es_CO.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - RAP bug-glibc-locales@gnu.org
*/
return array_replace_recursive(require __DIR__.'/es.php', [
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/is.php | src/Carbon/Lang/is.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Kristján Ingi Geirsson
*/
return [
'year' => '1 ár|:count ár',
'y' => '1 ár|:count ár',
'month' => '1 mánuður|:count mánuðir',
'm' => '1 mánuður|:count mánuðir',
'week' => '1 vika|:count vikur',
'w' => '1 vika|:count vikur',
'day' => '1 dagur|:count dagar',
'd' => '1 dagur|:count dagar',
'hour' => '1 klukkutími|:count klukkutímar',
'h' => '1 klukkutími|:count klukkutímar',
'minute' => '1 mínúta|:count mínútur',
'min' => '1 mínúta|:count mínútur',
'second' => '1 sekúnda|:count sekúndur',
's' => '1 sekúnda|:count sekúndur',
'ago' => ':time síðan',
'from_now' => ':time síðan',
'after' => ':time eftir',
'before' => ':time fyrir',
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => [', ', ' og '],
'meridiem' => ['fh', 'eh'],
'diff_now' => 'núna',
'diff_yesterday' => 'í gær',
'diff_tomorrow' => 'á morgun',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD.MM.YYYY',
'LL' => 'D. MMMM YYYY',
'LLL' => 'D. MMMM [kl.] HH:mm',
'LLLL' => 'dddd D. MMMM YYYY [kl.] HH:mm',
],
'weekdays' => ['sunnudaginn', 'mánudaginn', 'þriðjudaginn', 'miðvikudaginn', 'fimmtudaginn', 'föstudaginn', 'laugardaginn'],
'weekdays_short' => ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'],
'weekdays_min' => ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'],
'months' => ['janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní', 'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember'],
'months_short' => ['jan', 'feb', 'mar', 'apr', 'maí', 'jún', 'júl', 'ágú', 'sep', 'okt', 'nóv', 'des'],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/fr_ML.php | src/Carbon/Lang/fr_ML.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/fr.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_PN.php | src/Carbon/Lang/en_PN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ar_SO.php | src/Carbon/Lang/ar_SO.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/ar.php', [
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_UG.php | src/Carbon/Lang/en_UG.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/wa.php | src/Carbon/Lang/wa.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/wa_BE.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/sr_Latn_ME.php | src/Carbon/Lang/sr_Latn_ME.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Glavić
* - Milos Sakovic
*/
use Carbon\CarbonInterface;
use Symfony\Component\Translation\PluralizationRules;
// @codeCoverageIgnoreStart
if (class_exists(PluralizationRules::class)) {
PluralizationRules::set(static function ($number) {
return PluralizationRules::get($number, 'sr');
}, 'sr_Latn_ME');
}
// @codeCoverageIgnoreEnd
return array_replace_recursive(require __DIR__.'/sr.php', [
'month' => ':count mjesec|:count mjeseca|:count mjeseci',
'week' => ':count nedjelja|:count nedjelje|:count nedjelja',
'second' => ':count sekund|:count sekunde|:count sekundi',
'ago' => 'prije :time',
'from_now' => 'za :time',
'after' => ':time nakon',
'before' => ':time prije',
'week_from_now' => ':count nedjelju|:count nedjelje|:count nedjelja',
'week_ago' => ':count nedjelju|:count nedjelje|:count nedjelja',
'second_ago' => ':count sekund|:count sekunde|:count sekundi',
'diff_tomorrow' => 'sjutra',
'calendar' => [
'nextDay' => '[sjutra u] LT',
'nextWeek' => static fn (CarbonInterface $date) => match ($date->dayOfWeek) {
0 => '[u nedjelju u] LT',
3 => '[u srijedu u] LT',
6 => '[u subotu u] LT',
default => '[u] dddd [u] LT',
},
'lastWeek' => static fn (CarbonInterface $date) => match ($date->dayOfWeek) {
0 => '[prošle nedjelje u] LT',
1 => '[prošle nedjelje u] LT',
2 => '[prošlog utorka u] LT',
3 => '[prošle srijede u] LT',
4 => '[prošlog četvrtka u] LT',
5 => '[prošlog petka u] LT',
default => '[prošle subote u] LT',
},
],
'weekdays' => ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'],
'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_RW.php | src/Carbon/Lang/en_RW.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/bhb_IN.php | src/Carbon/Lang/bhb_IN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Samsung Electronics Co., Ltd. alexey.merzlyakov@samsung.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'D/M/YY',
],
'months' => ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
'weekdays' => ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
'weekdays_short' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
'weekdays_min' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ts_ZA.php | src/Carbon/Lang/ts_ZA.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'DD/MM/YYYY',
],
'months' => ['Sunguti', 'Nyenyenyani', 'Nyenyankulu', 'Dzivamisoko', 'Mudyaxihi', 'Khotavuxika', 'Mawuwani', 'Mhawuri', 'Ndzhati', 'Nhlangula', 'Hukuri', 'N\'wendzamhala'],
'months_short' => ['Sun', 'Yan', 'Kul', 'Dzi', 'Mud', 'Kho', 'Maw', 'Mha', 'Ndz', 'Nhl', 'Huk', 'N\'w'],
'weekdays' => ['Sonto', 'Musumbhunuku', 'Ravumbirhi', 'Ravunharhu', 'Ravumune', 'Ravuntlhanu', 'Mugqivela'],
'weekdays_short' => ['Son', 'Mus', 'Bir', 'Har', 'Ne', 'Tlh', 'Mug'],
'weekdays_min' => ['Son', 'Mus', 'Bir', 'Har', 'Ne', 'Tlh', 'Mug'],
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
'year' => 'malembe ya :count',
'y' => 'malembe ya :count',
'a_year' => 'malembe ya :count',
'month' => 'tin’hweti ta :count',
'm' => 'tin’hweti ta :count',
'a_month' => 'tin’hweti ta :count',
'week' => 'mavhiki ya :count',
'w' => 'mavhiki ya :count',
'a_week' => 'mavhiki ya :count',
'day' => 'masiku :count',
'd' => 'masiku :count',
'a_day' => 'masiku :count',
'hour' => 'tiawara ta :count',
'h' => 'tiawara ta :count',
'a_hour' => 'tiawara ta :count',
'minute' => 'timinete ta :count',
'min' => 'timinete ta :count',
'a_minute' => 'timinete ta :count',
'second' => 'tisekoni ta :count',
's' => 'tisekoni ta :count',
'a_second' => 'tisekoni ta :count',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/sr_Latn.php | src/Carbon/Lang/sr_Latn.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/sr.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/fr_MG.php | src/Carbon/Lang/fr_MG.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/fr.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/raj_IN.php | src/Carbon/Lang/raj_IN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - meghrajsuthar03@gmail.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'D/M/YY',
],
'months' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्टूबर', 'नवंबर', 'दिसंबर'],
'months_short' => ['जन', 'फर', 'मार्च', 'अप्रै', 'मई', 'जून', 'जुल', 'अग', 'सित', 'अक्टू', 'नव', 'दिस'],
'weekdays' => ['रविवार', 'सोमवार', 'मंगल्लवार', 'बुधवार', 'बृहस्पतिवार', 'शुक्रवार', 'शनिवार'],
'weekdays_short' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पति', 'शुक्र', 'शनि'],
'weekdays_min' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पति', 'शुक्र', 'शनि'],
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
'meridiem' => ['पूर्वाह्न', 'अपराह्न'],
'year' => ':count आंहू', // less reliable
'y' => ':count आंहू', // less reliable
'a_year' => ':count आंहू', // less reliable
'month' => ':count सूरज', // less reliable
'm' => ':count सूरज', // less reliable
'a_month' => ':count सूरज', // less reliable
'week' => ':count निवाज', // less reliable
'w' => ':count निवाज', // less reliable
'a_week' => ':count निवाज', // less reliable
'day' => ':count अेक', // less reliable
'd' => ':count अेक', // less reliable
'a_day' => ':count अेक', // less reliable
'hour' => ':count दुनियांण', // less reliable
'h' => ':count दुनियांण', // less reliable
'a_hour' => ':count दुनियांण', // less reliable
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/nhn.php | src/Carbon/Lang/nhn.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Unknown default region, use the first alphabetically.
*/
return require __DIR__.'/nhn_MX.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/sq.php | src/Carbon/Lang/sq.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - François B
* - JD Isaacks
* - Fadion Dashi
*/
return [
'year' => ':count vit|:count vjet',
'a_year' => 'një vit|:count vite',
'y' => ':count v.',
'month' => ':count muaj',
'a_month' => 'një muaj|:count muaj',
'm' => ':count muaj',
'week' => ':count javë',
'a_week' => ':count javë|:count javë',
'w' => ':count j.',
'day' => ':count ditë',
'a_day' => 'një ditë|:count ditë',
'd' => ':count d.',
'hour' => ':count orë',
'a_hour' => 'një orë|:count orë',
'h' => ':count o.',
'minute' => ':count minutë|:count minuta',
'a_minute' => 'një minutë|:count minuta',
'min' => ':count min.',
'second' => ':count sekondë|:count sekonda',
'a_second' => 'disa sekonda|:count sekonda',
's' => ':count s.',
'ago' => ':time më parë',
'from_now' => 'në :time',
'after' => ':time pas',
'before' => ':time para',
'diff_now' => 'tani',
'diff_today' => 'Sot',
'diff_today_regexp' => 'Sot(?:\\s+në)?',
'diff_yesterday' => 'dje',
'diff_yesterday_regexp' => 'Dje(?:\\s+në)?',
'diff_tomorrow' => 'nesër',
'diff_tomorrow_regexp' => 'Nesër(?:\\s+në)?',
'diff_before_yesterday' => 'pardje',
'diff_after_tomorrow' => 'pasnesër',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd, D MMMM YYYY HH:mm',
],
'calendar' => [
'sameDay' => '[Sot në] LT',
'nextDay' => '[Nesër në] LT',
'nextWeek' => 'dddd [në] LT',
'lastDay' => '[Dje në] LT',
'lastWeek' => 'dddd [e kaluar në] LT',
'sameElse' => 'L',
],
'ordinal' => ':number.',
'meridiem' => ['PD', 'MD'],
'months' => ['janar', 'shkurt', 'mars', 'prill', 'maj', 'qershor', 'korrik', 'gusht', 'shtator', 'tetor', 'nëntor', 'dhjetor'],
'months_short' => ['jan', 'shk', 'mar', 'pri', 'maj', 'qer', 'kor', 'gus', 'sht', 'tet', 'nën', 'dhj'],
'weekdays' => ['e diel', 'e hënë', 'e martë', 'e mërkurë', 'e enjte', 'e premte', 'e shtunë'],
'weekdays_short' => ['die', 'hën', 'mar', 'mër', 'enj', 'pre', 'sht'],
'weekdays_min' => ['d', 'h', 'ma', 'më', 'e', 'p', 'sh'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => [', ', ' dhe '],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ca_ES_Valencia.php | src/Carbon/Lang/ca_ES_Valencia.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Translation\PluralizationRules;
// @codeCoverageIgnoreStart
if (class_exists(PluralizationRules::class)) {
PluralizationRules::set(static function ($number) {
return PluralizationRules::get($number, 'ca');
}, 'ca_ES_Valencia');
}
// @codeCoverageIgnoreEnd
return array_replace_recursive(require __DIR__.'/ca.php', [
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/sh.php | src/Carbon/Lang/sh.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Томица Кораћ
* - Enrique Vidal
* - Christopher Dell
* - dmilisic
* - danijel
* - Miroslav Matkovic (mikki021)
*/
return [
'diff_now' => 'sada',
'diff_yesterday' => 'juče',
'diff_tomorrow' => 'sutra',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'MMMM D, YYYY',
'LLL' => 'DD MMM HH:mm',
'LLLL' => 'MMMM DD, YYYY HH:mm',
],
'year' => ':count godina|:count godine|:count godina',
'y' => ':count g.',
'month' => ':count mesec|:count meseca|:count meseci',
'm' => ':count m.',
'week' => ':count nedelja|:count nedelje|:count nedelja',
'w' => ':count n.',
'day' => ':count dan|:count dana|:count dana',
'd' => ':count d.',
'hour' => ':count sat|:count sata|:count sati',
'h' => ':count č.',
'minute' => ':count minut|:count minuta|:count minuta',
'min' => ':count min.',
'second' => ':count sekund|:count sekunde|:count sekundi',
's' => ':count s.',
'ago' => 'pre :time',
'from_now' => 'za :time',
'after' => 'nakon :time',
'before' => ':time raniјe',
'weekdays' => ['Nedelja', 'Ponedeljak', 'Utorak', 'Sreda', 'Četvrtak', 'Petak', 'Subota'],
'weekdays_short' => ['Ned', 'Pon', 'Uto', 'Sre', 'Čet', 'Pet', 'Sub'],
'weekdays_min' => ['Ned', 'Pon', 'Uto', 'Sre', 'Čet', 'Pet', 'Sub'],
'months' => ['Januar', 'Februar', 'Mart', 'April', 'Maj', 'Jun', 'Jul', 'Avgust', 'Septembar', 'Oktobar', 'Novembar', 'Decembar'],
'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'],
'list' => [', ', ' i '],
'meridiem' => ['pre podne', 'po podne'],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/da.php | src/Carbon/Lang/da.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Rune Mønnike
* - François B
* - codenhagen
* - JD Isaacks
* - Jens Herlevsen
* - Ulrik McArdle (mcardle)
* - Frederik Sauer (FrittenKeeZ)
* - Janus Bahs Jacquet (kokoshneta)
*/
return [
'year' => ':count år|:count år',
'a_year' => 'et år|:count år',
'y' => ':count år|:count år',
'month' => ':count måned|:count måneder',
'a_month' => 'en måned|:count måneder',
'm' => ':count mdr.',
'week' => ':count uge|:count uger',
'a_week' => 'en uge|:count uger',
'w' => ':count u.',
'day' => ':count dag|:count dage',
'a_day' => ':count dag|:count dage',
'd' => ':count d.',
'hour' => ':count time|:count timer',
'a_hour' => 'en time|:count timer',
'h' => ':count t.',
'minute' => ':count minut|:count minutter',
'a_minute' => 'et minut|:count minutter',
'min' => ':count min.',
'second' => ':count sekund|:count sekunder',
'a_second' => 'få sekunder|:count sekunder',
's' => ':count s.',
'ago' => 'for :time siden',
'from_now' => 'om :time',
'after' => ':time efter',
'before' => ':time før',
'diff_now' => 'nu',
'diff_today' => 'i dag',
'diff_today_regexp' => 'i dag(?:\\s+kl.)?',
'diff_yesterday' => 'i går',
'diff_yesterday_regexp' => 'i går(?:\\s+kl.)?',
'diff_tomorrow' => 'i morgen',
'diff_tomorrow_regexp' => 'i morgen(?:\\s+kl.)?',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD.MM.YYYY',
'LL' => 'D. MMMM YYYY',
'LLL' => 'D. MMMM YYYY HH:mm',
'LLLL' => 'dddd [d.] D. MMMM YYYY [kl.] HH:mm',
],
'calendar' => [
'sameDay' => '[i dag kl.] LT',
'nextDay' => '[i morgen kl.] LT',
'nextWeek' => 'på dddd [kl.] LT',
'lastDay' => '[i går kl.] LT',
'lastWeek' => '[i] dddd[s kl.] LT',
'sameElse' => 'L',
],
'ordinal' => ':number.',
'months' => ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
'months_short' => ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'],
'weekdays' => ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
'weekdays_short' => ['søn.', 'man.', 'tir.', 'ons.', 'tor.', 'fre.', 'lør.'],
'weekdays_min' => ['sø.', 'ma.', 'ti.', 'on.', 'to.', 'fr.', 'lø.'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => [', ', ' og '],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/bn_IN.php | src/Carbon/Lang/bn_IN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org
*/
return array_replace_recursive(require __DIR__.'/bn.php', [
'formats' => [
'L' => 'D/M/YY',
],
'months' => ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
'months_short' => ['জানু', 'ফেব', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
'weekdays' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'],
'weekdays_short' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'],
'weekdays_min' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'],
'day_of_first_week_of_year' => 1,
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_KN.php | src/Carbon/Lang/en_KN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/kam.php | src/Carbon/Lang/kam.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
'meridiem' => ['Ĩyakwakya', 'Ĩyawĩoo'],
'weekdays' => ['Wa kyumwa', 'Wa kwambĩlĩlya', 'Wa kelĩ', 'Wa katatũ', 'Wa kana', 'Wa katano', 'Wa thanthatũ'],
'weekdays_short' => ['Wky', 'Wkw', 'Wkl', 'Wtũ', 'Wkn', 'Wtn', 'Wth'],
'weekdays_min' => ['Wky', 'Wkw', 'Wkl', 'Wtũ', 'Wkn', 'Wtn', 'Wth'],
'months' => ['Mwai wa mbee', 'Mwai wa kelĩ', 'Mwai wa katatũ', 'Mwai wa kana', 'Mwai wa katano', 'Mwai wa thanthatũ', 'Mwai wa muonza', 'Mwai wa nyaanya', 'Mwai wa kenda', 'Mwai wa ĩkumi', 'Mwai wa ĩkumi na ĩmwe', 'Mwai wa ĩkumi na ilĩ'],
'months_short' => ['Mbe', 'Kel', 'Ktũ', 'Kan', 'Ktn', 'Tha', 'Moo', 'Nya', 'Knd', 'Ĩku', 'Ĩkm', 'Ĩkl'],
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd, D MMMM YYYY HH:mm',
],
// Too unreliable
/*
'year' => ':count mbua', // less reliable
'y' => ':count mbua', // less reliable
'a_year' => ':count mbua', // less reliable
'month' => ':count ndakitali', // less reliable
'm' => ':count ndakitali', // less reliable
'a_month' => ':count ndakitali', // less reliable
'day' => ':count wia', // less reliable
'd' => ':count wia', // less reliable
'a_day' => ':count wia', // less reliable
'hour' => ':count orasan', // less reliable
'h' => ':count orasan', // less reliable
'a_hour' => ':count orasan', // less reliable
'minute' => ':count orasan', // less reliable
'min' => ':count orasan', // less reliable
'a_minute' => ':count orasan', // less reliable
*/
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/mfe_MU.php | src/Carbon/Lang/mfe_MU.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'first_day_of_week' => 0,
'formats' => [
'L' => 'DD/MM/YY',
],
'months' => ['zanvie', 'fevriye', 'mars', 'avril', 'me', 'zin', 'zilye', 'out', 'septam', 'oktob', 'novam', 'desam'],
'months_short' => ['zan', 'fev', 'mar', 'avr', 'me', 'zin', 'zil', 'out', 'sep', 'okt', 'nov', 'des'],
'weekdays' => ['dimans', 'lindi', 'mardi', 'merkredi', 'zedi', 'vandredi', 'samdi'],
'weekdays_short' => ['dim', 'lin', 'mar', 'mer', 'ze', 'van', 'sam'],
'weekdays_min' => ['dim', 'lin', 'mar', 'mer', 'ze', 'van', 'sam'],
'year' => ':count banané',
'y' => ':count banané',
'a_year' => ':count banané',
'month' => ':count mwa',
'm' => ':count mwa',
'a_month' => ':count mwa',
'week' => ':count sémenn',
'w' => ':count sémenn',
'a_week' => ':count sémenn',
'day' => ':count zour',
'd' => ':count zour',
'a_day' => ':count zour',
'hour' => ':count -er-tan',
'h' => ':count -er-tan',
'a_hour' => ':count -er-tan',
'minute' => ':count minitt',
'min' => ':count minitt',
'a_minute' => ':count minitt',
'second' => ':count déziém',
's' => ':count déziém',
'a_second' => ':count déziém',
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/gl_ES.php | src/Carbon/Lang/gl_ES.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/gl.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/doi_IN.php | src/Carbon/Lang/doi_IN.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Red Hat Pune libc-alpha@sourceware.org
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'formats' => [
'L' => 'D/M/YY',
],
'months' => ['जनवरी', 'फरवरी', 'मार्च', 'एप्रैल', 'मेई', 'जून', 'जूलै', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'],
'months_short' => ['जनवरी', 'फरवरी', 'मार्च', 'एप्रैल', 'मेई', 'जून', 'जूलै', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'],
'weekdays' => ['ऐतबार', 'सोमबार', 'मंगलबर', 'बुधबार', 'बीरबार', 'शुक्करबार', 'श्नीचरबार'],
'weekdays_short' => ['ऐत', 'सोम', 'मंगल', 'बुध', 'बीर', 'शुक्कर', 'श्नीचर'],
'weekdays_min' => ['ऐत', 'सोम', 'मंगल', 'बुध', 'बीर', 'शुक्कर', 'श्नीचर'],
'first_day_of_week' => 0,
'day_of_first_week_of_year' => 1,
'meridiem' => ['सञं', 'सबेर'],
'second' => ':count सङार', // less reliable
's' => ':count सङार', // less reliable
'a_second' => ':count सङार', // less reliable
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/en_TC.php | src/Carbon/Lang/en_TC.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/en.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ar_Shakl.php | src/Carbon/Lang/ar_Shakl.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - Abdellah Chadidi
* - Atef Ben Ali (atefBB)
* - Mohamed Sabil (mohamedsabil83)
*/
// Same for long and short
$months = [
// @TODO add shakl to months
'يناير',
'فبراير',
'مارس',
'أبريل',
'مايو',
'يونيو',
'يوليو',
'أغسطس',
'سبتمبر',
'أكتوبر',
'نوفمبر',
'ديسمبر',
];
return [
'year' => implode('|', ['{0}:count سَنَة', '{1}سَنَة', '{2}سَنَتَيْن', ']2,11[:count سَنَوَات', ']10,Inf[:count سَنَة']),
'a_year' => implode('|', ['{0}:count سَنَة', '{1}سَنَة', '{2}سَنَتَيْن', ']2,11[:count سَنَوَات', ']10,Inf[:count سَنَة']),
'month' => implode('|', ['{0}:count شَهْرَ', '{1}شَهْرَ', '{2}شَهْرَيْن', ']2,11[:count أَشْهُر', ']10,Inf[:count شَهْرَ']),
'a_month' => implode('|', ['{0}:count شَهْرَ', '{1}شَهْرَ', '{2}شَهْرَيْن', ']2,11[:count أَشْهُر', ']10,Inf[:count شَهْرَ']),
'week' => implode('|', ['{0}:count أُسْبُوع', '{1}أُسْبُوع', '{2}أُسْبُوعَيْن', ']2,11[:count أَسَابِيع', ']10,Inf[:count أُسْبُوع']),
'a_week' => implode('|', ['{0}:count أُسْبُوع', '{1}أُسْبُوع', '{2}أُسْبُوعَيْن', ']2,11[:count أَسَابِيع', ']10,Inf[:count أُسْبُوع']),
'day' => implode('|', ['{0}:count يَوْم', '{1}يَوْم', '{2}يَوْمَيْن', ']2,11[:count أَيَّام', ']10,Inf[:count يَوْم']),
'a_day' => implode('|', ['{0}:count يَوْم', '{1}يَوْم', '{2}يَوْمَيْن', ']2,11[:count أَيَّام', ']10,Inf[:count يَوْم']),
'hour' => implode('|', ['{0}:count سَاعَة', '{1}سَاعَة', '{2}سَاعَتَيْن', ']2,11[:count سَاعَات', ']10,Inf[:count سَاعَة']),
'a_hour' => implode('|', ['{0}:count سَاعَة', '{1}سَاعَة', '{2}سَاعَتَيْن', ']2,11[:count سَاعَات', ']10,Inf[:count سَاعَة']),
'minute' => implode('|', ['{0}:count دَقِيقَة', '{1}دَقِيقَة', '{2}دَقِيقَتَيْن', ']2,11[:count دَقَائِق', ']10,Inf[:count دَقِيقَة']),
'a_minute' => implode('|', ['{0}:count دَقِيقَة', '{1}دَقِيقَة', '{2}دَقِيقَتَيْن', ']2,11[:count دَقَائِق', ']10,Inf[:count دَقِيقَة']),
'second' => implode('|', ['{0}:count ثَانِيَة', '{1}ثَانِيَة', '{2}ثَانِيَتَيْن', ']2,11[:count ثَوَان', ']10,Inf[:count ثَانِيَة']),
'a_second' => implode('|', ['{0}:count ثَانِيَة', '{1}ثَانِيَة', '{2}ثَانِيَتَيْن', ']2,11[:count ثَوَان', ']10,Inf[:count ثَانِيَة']),
'ago' => 'مُنْذُ :time',
'from_now' => 'مِنَ الْآن :time',
'after' => 'بَعْدَ :time',
'before' => 'قَبْلَ :time',
// @TODO add shakl to translations below
'diff_now' => 'الآن',
'diff_today' => 'اليوم',
'diff_today_regexp' => 'اليوم(?:\\s+عند)?(?:\\s+الساعة)?',
'diff_yesterday' => 'أمس',
'diff_yesterday_regexp' => 'أمس(?:\\s+عند)?(?:\\s+الساعة)?',
'diff_tomorrow' => 'غداً',
'diff_tomorrow_regexp' => 'غدًا(?:\\s+عند)?(?:\\s+الساعة)?',
'diff_before_yesterday' => 'قبل الأمس',
'diff_after_tomorrow' => 'بعد غد',
'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']),
'period_interval' => 'كل :interval',
'period_start_date' => 'من :date',
'period_end_date' => 'إلى :date',
'months' => $months,
'months_short' => $months,
'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
'weekdays_min' => ['ح', 'اث', 'ثل', 'أر', 'خم', 'ج', 'س'],
'list' => ['، ', ' و '],
'first_day_of_week' => 6,
'day_of_first_week_of_year' => 1,
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'D/M/YYYY',
'LL' => 'D MMMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd D MMMM YYYY HH:mm',
],
'calendar' => [
'sameDay' => '[اليوم عند الساعة] LT',
'nextDay' => '[غدًا عند الساعة] LT',
'nextWeek' => 'dddd [عند الساعة] LT',
'lastDay' => '[أمس عند الساعة] LT',
'lastWeek' => 'dddd [عند الساعة] LT',
'sameElse' => 'L',
],
'meridiem' => ['ص', 'م'],
'weekend' => [5, 6],
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/fr_GP.php | src/Carbon/Lang/fr_GP.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return require __DIR__.'/fr.php';
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/ar_MR.php | src/Carbon/Lang/ar_MR.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/ar.php', [
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/br.php | src/Carbon/Lang/br.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Authors:
* - François B
* - Serhan Apaydın
* - JD Isaacks
*/
return [
'year' => '{1}:count bloaz|{3,4,5,9}:count bloaz|[0,Inf[:count vloaz',
'a_year' => '{1}ur bloaz|{3,4,5,9}:count bloaz|[0,Inf[:count vloaz',
'month' => '{1}:count miz|{2}:count viz|[0,Inf[:count miz',
'a_month' => '{1}ur miz|{2}:count viz|[0,Inf[:count miz',
'week' => ':count sizhun',
'a_week' => '{1}ur sizhun|:count sizhun',
'day' => '{1}:count devezh|{2}:count zevezh|[0,Inf[:count devezh',
'a_day' => '{1}un devezh|{2}:count zevezh|[0,Inf[:count devezh',
'hour' => ':count eur',
'a_hour' => '{1}un eur|:count eur',
'minute' => '{1}:count vunutenn|{2}:count vunutenn|[0,Inf[:count munutenn',
'a_minute' => '{1}ur vunutenn|{2}:count vunutenn|[0,Inf[:count munutenn',
'second' => ':count eilenn',
'a_second' => '{1}un nebeud segondennoù|[0,Inf[:count eilenn',
'ago' => ':time \'zo',
'from_now' => 'a-benn :time',
'diff_now' => 'bremañ',
'diff_today' => 'Hiziv',
'diff_today_regexp' => 'Hiziv(?:\\s+da)?',
'diff_yesterday' => 'decʼh',
'diff_yesterday_regexp' => 'Dec\'h(?:\\s+da)?',
'diff_tomorrow' => 'warcʼhoazh',
'diff_tomorrow_regexp' => 'Warc\'hoazh(?:\\s+da)?',
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D [a viz] MMMM YYYY',
'LLL' => 'D [a viz] MMMM YYYY HH:mm',
'LLLL' => 'dddd, D [a viz] MMMM YYYY HH:mm',
],
'calendar' => [
'sameDay' => '[Hiziv da] LT',
'nextDay' => '[Warc\'hoazh da] LT',
'nextWeek' => 'dddd [da] LT',
'lastDay' => '[Dec\'h da] LT',
'lastWeek' => 'dddd [paset da] LT',
'sameElse' => 'L',
],
'ordinal' => static fn ($number) => $number.($number === 1 ? 'añ' : 'vet'),
'months' => ['Genver', 'C\'hwevrer', 'Meurzh', 'Ebrel', 'Mae', 'Mezheven', 'Gouere', 'Eost', 'Gwengolo', 'Here', 'Du', 'Kerzu'],
'months_short' => ['Gen', 'C\'hwe', 'Meu', 'Ebr', 'Mae', 'Eve', 'Gou', 'Eos', 'Gwe', 'Her', 'Du', 'Ker'],
'weekdays' => ['Sul', 'Lun', 'Meurzh', 'Merc\'her', 'Yaou', 'Gwener', 'Sadorn'],
'weekdays_short' => ['Sul', 'Lun', 'Meu', 'Mer', 'Yao', 'Gwe', 'Sad'],
'weekdays_min' => ['Su', 'Lu', 'Me', 'Mer', 'Ya', 'Gw', 'Sa'],
'first_day_of_week' => 1,
'day_of_first_week_of_year' => 4,
'list' => [', ', ' hag '],
'meridiem' => ['A.M.', 'G.M.'],
'y' => ':count bl.',
'd' => ':count d',
'h' => ':count e',
'min' => ':count min',
's' => ':count s',
];
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
briannesbitt/Carbon | https://github.com/briannesbitt/Carbon/blob/6e037cd6239a150d74a54c62e300b269e88a89e3/src/Carbon/Lang/lag.php | src/Carbon/Lang/lag.php | <?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return array_replace_recursive(require __DIR__.'/en.php', [
'meridiem' => ['TOO', 'MUU'],
'weekdays' => ['Jumapíiri', 'Jumatátu', 'Jumaíne', 'Jumatáano', 'Alamíisi', 'Ijumáa', 'Jumamóosi'],
'weekdays_short' => ['Píili', 'Táatu', 'Íne', 'Táano', 'Alh', 'Ijm', 'Móosi'],
'weekdays_min' => ['Píili', 'Táatu', 'Íne', 'Táano', 'Alh', 'Ijm', 'Móosi'],
'months' => ['Kʉfúngatɨ', 'Kʉnaanɨ', 'Kʉkeenda', 'Kwiikumi', 'Kwiinyambála', 'Kwiidwaata', 'Kʉmʉʉnchɨ', 'Kʉvɨɨrɨ', 'Kʉsaatʉ', 'Kwiinyi', 'Kʉsaano', 'Kʉsasatʉ'],
'months_short' => ['Fúngatɨ', 'Naanɨ', 'Keenda', 'Ikúmi', 'Inyambala', 'Idwaata', 'Mʉʉnchɨ', 'Vɨɨrɨ', 'Saatʉ', 'Inyi', 'Saano', 'Sasatʉ'],
'first_day_of_week' => 1,
'formats' => [
'LT' => 'HH:mm',
'LTS' => 'HH:mm:ss',
'L' => 'DD/MM/YYYY',
'LL' => 'D MMM YYYY',
'LLL' => 'D MMMM YYYY HH:mm',
'LLLL' => 'dddd, D MMMM YYYY HH:mm',
],
]);
| php | MIT | 6e037cd6239a150d74a54c62e300b269e88a89e3 | 2026-01-04T15:02:34.459238Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.