/usr/share/ecere/extras/types/ShortDate.ec is in ecere-extras 0.44.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #ifdef ECERE_STATIC
public import static "ecere"
#else
public import "ecere"
#endif
static Array<const String> shortMonths
{ [
$"Jan", $"Feb", $"Mar", $"Apr", $"May", $"Jun", $"Jul", $"Aug", $"Sep", $"Oct", $"Nov", $"Dec"
] };
public struct ShortDate : Date
{
const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
if(day || month || year)
{
if(month >= january && month <= december)
sprintf(stringOutput, "%s %d, %d", shortMonths[month], day, year);
else
strcpy(stringOutput, $"Invalid date");
}
else
stringOutput[0] = 0;
return stringOutput;
}
bool SameDay(ShortDate b)
{
if(year == b.year && month == b.month && day == b.day)
return true;
return false;
}
ShortDate ::Today()
{
DateTime time { };
time.GetLocalTime();
return ShortDate { year = time.year, month = time.month, day = time.day };
}
};
|