Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated warning on strftime on due date extension (#67) #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

voegii
Copy link

@voegii voegii commented Jan 23, 2024

Solves #67

@voegii voegii force-pushed the feature/67-remove-deprecated-warning-strftime branch from 9dcdad3 to 2d8079e Compare January 23, 2024 16:07
get_string('strftimedaydatetime', 'langconfig'),
$duedate->duedate
) : "-";
return $duedate ? userdate($duedate->duedate) : "-";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for you contribution.

I am not quite sure whether using the userdate is a good idea here.
The docs from the Moodle Time API says

userdate - Gets formatted string that represents a date in user time (note that the format required by this function is the [strftime()](https://www.php.net/manual/en/function.strftime.php) format, not the more common format used by date())

From what I understand, this means that the date is displayed in the user's time zone. We normally don't use this at other places.

This is for example how we display the normal due date for a MUMIE-Task in mod/mumie/view.php

        $duedateinfo .= html_writer::tag(
            'p',
            strftime(
                get_string('strftimedaydatetime', 'langconfig'),
                $mumietask->duedate
            ),
            array('style' => 'font-weight: bold; margin-top:10px;')
        );

If using userdate means that the due date is converted into the user's time zone, I think that it is confusing to potentially display dates from different time zones, since we don't use the userdate at other locations.

@voegii voegii force-pushed the feature/67-remove-deprecated-warning-strftime branch from 2d8079e to 0a5d229 Compare June 5, 2024 07:11
@voegii voegii force-pushed the feature/67-remove-deprecated-warning-strftime branch from 0a5d229 to 31dd04e Compare June 14, 2024 06:18
@voegii voegii force-pushed the feature/67-remove-deprecated-warning-strftime branch from 31dd04e to fe64916 Compare June 14, 2024 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants