You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Timestamp cannot be configured in ExtentSparkReporter #206
I want to show seconds in the ExtentReport, but there is no "TimeStampFormat" option to configure that, even though the documentation and codebase (spark-config.json) indicates that it is possible:
Code running in Visual Studio
[extentreports-csharp]/[config]/spark-config.json in GitHub
var yourConfigPath= Path.Combine(@"..\..\..\..\", @"config\spark-config.json");
var spark = new ExtentSparkReporter("Spark.html");
spark.LoadJSONConfig(yourConfigPath);
@namilkimfree
Thank you for those instructions to load the config file. I successfully loaded and manipulated other settings via the spark-config.json file like theme, timelineEnabled, documentTitle and reportName. However the timestamps do not change regardless of what I change the format to in spark-config.json.
I want to change the timestamp format for each step of a test, underlined in my screenshot in my original post. We are not getting valuable data to see how many seconds it took to get to the next step, etc. Modifying the timeStampFormat in spark-config.json does not change the format anywhere at all on the report.
@namilkimfree Thank you for those instructions to load the config file. I successfully loaded and manipulated other settings via the spark-config.json file like theme, timelineEnabled, documentTitle and reportName. However the timestamps do not change regardless of what I change the format to in spark-config.json.
I want to change the timestamp format for each step of a test, underlined in my screenshot in my original post. We are not getting valuable data to see how many seconds it took to get to the next step, etc. Modifying the timeStampFormat in spark-config.json does not change the format anywhere at all on the report.
The timeStamp property was not serialized and was not used anywhere in the extent report library, and I think it should be removed from the documentation.
There is a possibility of datetime conflict issues with the multicultural provider. For example, if my local instance culture is set to en-US, if I pass "dd/MM/yyyy hh:mm:ss" (31/1/2024), it won't work. This could be a reason it is not implemented, I guess.
@sudheshg The seconds do display in other areas in that screenshot above. Perhaps, if not configurable, the steps could use that same format as is already used in those other places?
Again we are missing valuable log information here and may need to add our own timestamp each time we write to the log, which defeats the purpose a little of having a reporter like ExtentReports. 😁
@sudheshg The seconds do display in other areas in that screenshot above. Perhaps, if not configurable, the steps could use that same format as is already used in those other places? Again we are missing valuable log information here and may need to add our own timestamp each time we write to the log, which defeats the purpose a little of having a reporter like ExtentReports. 😁
Then need to pass the expected TimeZone info in the config file to match the timeStampformat.
As we are using the same report in different time zones the report shows different time formats according to the user system time format .
We need to set a specific time format , I tried using json-config but there is no change.
This issue is of high importance , could you please resolve this and give us an option to set format.
I set my date in the details log with a separator (for example : TIME )
string myText = "my log line";
myText = $"{DateTime.Now:HH:mm:ss}_TIME_{myText}";
Test.Log(status, myText , media); // Test is ExtentTest object, media is optionnal
in config of ExtentSparkReporter, I set a json script like this :
ExtentSparkReporter extentSparkReporter = new ExtentSparkReporter(path);
extentSparkReporter.Config.JS = @"
var elements = document.getElementsByClassName('event-row')
for (let i = 0; i < elements.length; i++) {
var cellules = elements[i].getElementsByTagName('td');
var split = cellules[2].innerHTML.split('_TIME_');
var timestamp = split[0].replace('\n', '');
cellules[1].innerHTML = timestamp;
cellules[2].innerHTML = split[1];
}";
Thank you for the work around , the issue I am facing right now is
In my report generated I see that it is picking up the date time of the system time
I need to fix the time stamp which should not change with Time zone change
Please help me fix the time stamp to be consistent across all timezones
@dcdraper ExtentReports/Views/Spark/Partials/Log.cshtml at line19
The TimeStamp value is hardcoded as a short. In order to modify it, you need to read the config value and format it.
@namilkimfree Thanks for responding again, but I do not have any idea how I can read or format it. There is no config option for Timestamp. Have you done this? Do you have an example or sample code?
The fix in this branch fixes the issue. There are several fixes made to the template due to which, I will need to do further testing + write tests as necessary.
@anshooarora Thank you for working on this! I was curious so I tried the fix branch today, and it is giving me what we desperately needed.
I did notice a couple things I did not quite expect...
Removing the date part of the format also removes it from the header, which does not matter to me but seems different than how it used to work. If you look at my original screenshot you can see the header has the date part but the Timestamp column does not:
Using the date part adds it back to the header but makes the Timestamp too long to fit on one line; the report does not auto-adjust for that:
Is still is not fixed in v5.0.4. It does not matter which format I use, it always displays datetime in this format:
I want report to display datetime in this format (changed from devtools):
Activity
namilkimfree commentedon Jan 22, 2024
did you loader json config?
check please.
@dcdraper
dcdraper commentedon Jan 25, 2024
@namilkimfree
Thank you for those instructions to load the config file. I successfully loaded and manipulated other settings via the spark-config.json file like theme, timelineEnabled, documentTitle and reportName. However the timestamps do not change regardless of what I change the format to in spark-config.json.
I want to change the timestamp format for each step of a test, underlined in my screenshot in my original post. We are not getting valuable data to see how many seconds it took to get to the next step, etc. Modifying the timeStampFormat in spark-config.json does not change the format anywhere at all on the report.
sudheshg commentedon Jan 31, 2024
The timeStamp property was not serialized and was not used anywhere in the extent report library, and I think it should be removed from the documentation.
There is a possibility of datetime conflict issues with the multicultural provider. For example, if my local instance culture is set to en-US, if I pass "dd/MM/yyyy hh:mm:ss" (31/1/2024), it won't work. This could be a reason it is not implemented, I guess.
dcdraper commentedon Jan 31, 2024
@sudheshg The seconds do display in other areas in that screenshot above. Perhaps, if not configurable, the steps could use that same format as is already used in those other places?
Again we are missing valuable log information here and may need to add our own timestamp each time we write to the log, which defeats the purpose a little of having a reporter like ExtentReports. 😁
sudheshg commentedon Feb 1, 2024
Then need to pass the expected TimeZone info in the config file to match the timeStampformat.
dcdraper commentedon Feb 2, 2024
I do not know what this means. There is no timezone option in the config file.
SerreauFrederic commentedon Mar 19, 2024
I have the same problem, I'm on a French machine, and I don't have the seconds displayed.
I tested with the json configuration but it doesn't change anything, and no possibility in C#.
Is there a solution ?
sharon-sharonmuffins commentedon Mar 21, 2024
As we are using the same report in different time zones the report shows different time formats according to the user system time format .
We need to set a specific time format , I tried using json-config but there is no change.
This issue is of high importance , could you please resolve this and give us an option to set format.
SerreauFrederic commentedon Mar 21, 2024
For workaround the issue, I did this solution :
I set my date in the details log with a separator (for example : TIME )
in config of ExtentSparkReporter, I set a json script like this :
at the end, my timestamp has seconds :)
sharon-sharonmuffins commentedon Mar 21, 2024
Thank you for the work around , the issue I am facing right now is

In my report generated I see that it is picking up the date time of the system time
I need to fix the time stamp which should not change with Time zone change
Please help me fix the time stamp to be consistent across all timezones
SerreauFrederic commentedon Mar 21, 2024
You can use DateTime.UtcNow
namilkimfree commentedon Apr 16, 2024
@dcdraper ExtentReports/Views/Spark/Partials/Log.cshtml at line19
The TimeStamp value is hardcoded as a short. In order to modify it, you need to read the config value and format it.
dcdraper commentedon Apr 16, 2024
@namilkimfree Thanks for responding again, but I do not have any idea how I can read or format it. There is no config option for Timestamp. Have you done this? Do you have an example or sample code?
anshooarora commentedon Apr 25, 2024
Sorry for the delay, currently looking into this.
Initial: allows setting timestamp format via config #206
anshooarora commentedon Apr 26, 2024
The fix in this branch fixes the issue. There are several fixes made to the template due to which, I will need to do further testing + write tests as necessary.
dcdraper commentedon May 10, 2024
@anshooarora
Thank you for working on this! I was curious so I tried the fix branch today, and it is giving me what we desperately needed.
I did notice a couple things I did not quite expect...
Removing the date part of the format also removes it from the header, which does not matter to me but seems different than how it used to work. If you look at my original screenshot you can see the header has the date part but the Timestamp column does not:

Using the date part adds it back to the header but makes the Timestamp too long to fit on one line; the report does not auto-adjust for that:

anshooarora commentedon Jun 14, 2024
Thanks, this is also fixed. I will prepare for release next.
PS. this fix should also improve performance slightly.
(Sorry for the delay in this, I did not have a Windows machine (until now) and doing all this on a mac was quite painful)
Timestamp cannot be configured in ExtentSparkReporter Issue#206 (#215)
smestvirishvili commentedon Jun 28, 2024
Is still is not fixed in v5.0.4. It does not matter which format I use, it always displays datetime in this format:


I want report to display datetime in this format (changed from devtools):
anshooarora commentedon Jun 28, 2024
@smestvirishvili - it should change the event timestamp, please see the original post for context.