allegedwizard/simple-calendar-php

该包最新版本(v1.0.1)没有可用的许可证信息。

根据输入的月份/年份生成7x6序列日历数组。

v1.0.1 2023-08-31 03:12 UTC

This package is auto-updated.

Last update: 2024-09-30 01:52:24 UTC


README

AllegedWizard编写

composer require allegedwizard/simple-calendar-php

为给定的输入月份和年份生成日历数据模型数组。

可用于构建日历视图。

<?php
// Example output of:
$calendar = new SimpleCalendar( 'August', 2023 );
$model = $calendar->toArray();
print_r( $model );
Array
(
    [0] => Array
        (
            [date] => 2023-07-30
            [day_of_month] => 30
            [is_prev_month] => 1
            [is_current_month] => 
            [is_next_month] => 
            [is_today] => 
        )

    [1] => Array
        (
            [date] => 2023-07-31
            [day_of_month] => 31
            [is_prev_month] => 1
            [is_current_month] => 
            [is_next_month] => 
            [is_today] => 
        )

    [2] => Array
        (
            [date] => 2023-08-01
            [day_of_month] => 1
            [is_prev_month] => 
            [is_current_month] => 1
            [is_next_month] => 
            [is_today] => 
        )
    ...
  • 任意星期第一天日历分配(默认为星期日)。
  • 允许覆盖date($format, $timestamp)格式化函数,例如在WordPress环境中使用wp_date()来利用本地化时间。

请参阅tests/simple-calendar-test.php以获取完整的日历示例。