Trying to fix this error as I mentioned in title but cant figure it out. I am not comparing anything why I get this I don't know. I tried to change strings to float but no success. Maybe I should change StringTools but not sure what use instead of that.
package com.bykd.output;
@:final class DateOutput
{
public static inline var HOUR : String = "%h";
public static inline var MONTH : String = "%m";
public static inline var SECOND : String = "%s";
public static inline var MINUTE : String = "%i";
public static inline var DAY : String = "%d";
public static inline var YEAR : String = "%y";
public function new()
{
//super();
}
public static function formatDate(date : Date, format : String) : String
{
var output : String = null;
output = format;
output = StringTools.replace(output, DAY, leadZero(date.getDay));
output = StringTools.replace(output, MONTH, leadZero(date.getMonth));
output = StringTools.replace(output, YEAR, date.getFullYear);
return output;
}
public static function formatTime(date : Date, format : String) : String
{
var output : String = null;
output = format;
output = StringTools.replace(output, HOUR, leadZero(date.getHours));
output = StringTools.replace(output, MINUTE, leadZero(date.getMinutes));
output = StringTools.replace(output, SECOND, leadZero(date.getSeconds));
return output;
}
public static function leadZero(num : Float) : String
{
return Std.string("00" + num).substr(-2, 2);
}
}