Code Monkey home page Code Monkey logo

Comments (2)

goose2000 avatar goose2000 commented on August 14, 2024

I moved the $field->displayformat condition to the top of the else if conditions, this respects the custom date format display and still lets you choose to input date only or with time fields too.

file:
\mod\datalynx\field\time\renderer.php

`
public function render_display_mode(stdClass $entry, array $params) {
$field = $this->_field;
$fieldid = $field->id();

    $strtime = '';
    if (isset($entry->{"c{$fieldid}_content"})) {
        if ($content = $entry->{"c{$fieldid}_content"}) {
            if (!empty($params['format'])) {
                $strtime = userdate($content, $params['format']);
	} else if (!empty($field->displayformat)) {  // this goes to the top
                $strtime = userdate($content, $field->displayformat);
            } else if (isset($params['date']) || $field->dateonly) {
                $strtime = userdate($content, get_string("strftimedate"));
            } else if (isset($params['timestamp'])) {
                $strtime = $content;
            } else {
                $date = getdate($content);
                if ($date['seconds'] || $date['minutes'] || $date['hours']) {
                    $strtime = userdate($content, get_string("strftimedatetime"));
                } else {
                    $strtime = userdate($content, get_string("strftimedate"));
                }
            }
        }
    }
    return $strtime;
}`

from moodle-mod_datalynx.

dasistwas avatar dasistwas commented on August 14, 2024

Hi @goose2000 , in order to integrate your patch it would be great if you could do the following:

  1. Fork the repo to your account (right top on github)
  2. Make the changes on your repo (you can use the online editor in github directly)
  3. Make a pull request https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request#creating-the-pull-request

then I can merge your changes.

Kind regards,
David

from moodle-mod_datalynx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.