Page MenuHomePhabricator

enhance Semantic Result Formats Math to calculate Dates
Closed, InvalidPublic

Description

Author: thomas.ramm

Description:
I add to the SemanticResultFormats/formats/math/SRF_Math.php the lines and can use this Result Formats to calculate dates, for querys like "get the last president" if the president-pages has a date field "starting Job".

This resolution give the timestamp with decimalseparator, so i have to convert the result.

My Example:
Question: When was my last Review?
Solution: {{#time: Y-m-d|@{{#replace:{{#ask: [[HasReview::{{{1|}}}]] ?DateOfVisit |format=max}}|.|}}}}

Codechange ond SRF_Math.php:
110+ case SMWDataItem::TYPE_TIME:
111+ $numbers[] = $dataItem->getMwTimestamp();
112+ break;

Maybe there is a better solution than getMwTimestamp(), but i dont know the available functions to return as "normal" date.


Version: unspecified
Severity: enhancement

Details

Reference
bz62564

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:02 AM
bzimport set Reference to bz62564.
bzimport added a subscriber: Unknown Object (MLST).
Aklapper triaged this task as Lowest priority.Mar 22 2015, 5:08 PM
Aklapper subscribed.

In T64114, the SMW maintainers decided to track MediaWiki-extensions-SemanticBundle issues in GitHub at https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues (and not anymore in Wikimedia Bugzilla/Phabricator). If the problem that you reported in this task still happens with a recent and supported version of SemanticBundle, we kindly ask you to transfer the task to GitHub. Thanks for your understanding!