We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bug with date parsing from JSON

I’m using Aspose Words with Total license for Java.
And I’m working with templates and ReportingEngine.
I got a sample template with following fields:
(the exact name and date format doesn’t matter)

And I got a sample app to test this template:

public static com.aspose.words.Document fillWordTemplate(byte[] templateFile) {

try {

    String data = "{\"issuedate\": \"1997-03-30\", \"birthdate\": \"1977-03-30\"}";
    JsonDataSource printFormDataAsJsonDataSource = new JsonDataSource(new ByteArrayInputStream(data.getBytes()));
    ReportingEngine engine = new ReportingEngine();
    Document template = new Document(new ByteArrayInputStream(templateFile));
    engine.buildReport(template, printFormDataAsJsonDataSource);

    return template;
catch (Exception e) {

    throw new IllegalStateException("Error occurred while building docx file from template", e);


I expect the dates to be filled according to the format with their exact values: 30.03.1997 and 30.03.1977.
However, I got this:
image.png (5.2 KB)
Why 29.03.1997? Why does date change by 1 day?
I made and investigation and found that the behavior depends on my system time zone.
Almost all time zones that are placed over the former USSR are producing this 1 day offset. For example Moscow time, Yekaterinburg time, Aqtobe time (Kazakhstan), Omsk Time etc.
However, GMT (London), Australian time, and many other time zones work well giving 30 and 30.
But I can’t change a time zone for my production server. What do I do?
Here is my template file.
template.docx (10.1 KB)
My system:
Ubuntu 20.04.3 LTS
openjdk 11.0.10 2021-01-19
Aspose words version: 21.12 (also tested on 21.2)
Time zone MSK (UTC+03)

@whitebearspirit Thank you for reporting this problem to us. I have logged it as WORDSJAVA-2681. We will keep you informed and let you know once it is resolved.