﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
22805	MAPCSS: Error while parsing a mapcss file (division, comment).	mikeho	team	"1- In some expressions the division did not work well:

{{{#!mapcss
tmpDy2: to_double(get(split(""."", osm_timestamp() / 86400), 0)) / 365.25);   /* did not work well */
}}}

Multiplication works fine:

{{{#!mapcss
tmp365: to_double( 1 / 365.25 );        
tmpDy2: to_double(get(split(""."", osm_timestamp() / 86400), 0)) * prop(""tmp365"");  
}}}

2- The comments in the line before cause an error!
{{{#!mapcss
tmp365: to_double( 1 / 365.25 );                                                   /* comment leads to an error ! */
tmpDy2: to_double(get(split(""."", osm_timestamp() / 86400), 0)) * prop(""tmp365"");   /* comment leads to an error ! */
}}}

3- The mapcss style code:

{{{#!mapcss
node|z20-[railway=signal]::layer_521 { z-index: 521; text-offset-x: -80; text-offset-y: -40; font-size: 20; text-color: #FFF020; text-anchor-horizontal: right; text-anchor-vertical: below; text-halo-opacity: 1; text-halo-color: #202020; text-halo-radius: 2; text-allow-overlap: true;
    /*                                                 
    tmp365: to_double( 1 / 365.25 );   / * error with an comment on end of line * /
    tmpDy2: to_double(get(split(""."", osm_timestamp() / 86400), 0)) * prop(""tmp365"");    / * error with an comment on end of line * /    
    */
                                                /* day per year / phaser error: division didn't work well (comment in row after accours an error !)  */
	tmp365: to_double( 1 / 365.25 );        
	tmpDy2: to_double(get(split(""."", osm_timestamp() / 86400), 0)) * prop(""tmp365"");  
                                                /* days since 01.01.1970 (comment in row before accours an error !)  */

    /* did not work well                                   with division: 
    tmpDy2: to_double(get(split(""."", osm_timestamp() / 86400), 0)) / 365.25);  
    */

    tmpDay: concat( 1970 + prop(""tmpDy2""));          /* year with positions after decimal point ""2023.12345"" */
    tYear:  get(split(""."", prop(""tmpDay"")), 0);      /* year only: - before decimal point - e.g.: ""2023""     */
    tmpMo1: get(split(""."", prop(""tmpDay"")), 1);      /* only position after decimal point - e.g.: ""12345""    */
    tmpMo2: concat(""0."",   prop(""tmpMo1""));          /* .. now with ""0"" and decimal point - e.g.: ""0.12345""  */
    tmpMo3: prop(""tmpMo2"") * 12 + 1;                 /* tmpMo2 * 12 (Month) + 1 (Month) --> 1, ... ,12       */
    tMonth: substring( prop(""tmpMo3""), 0, 5 );       /* only e.g. ""12.34"" (5 digits)                         */
    text:   concat(osm_user_name(), "" - ca. Year: "", prop(""tYear""), ""  ca. Month: "", prop(""tMonth"") ); 
}
}}}

4- The mapcss-file is attached.
"	defect	new	normal		Core				
