question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DateTime Timezone Issues

See original GitHub issue

After updating from a very old version, I noticed a change with DateTime mapping. Even with a DateTime converter that changes the Kind of DateTime, something in AutoMapper changes it to UTC time. So for example, let’s say I want the DateTime to be specified as Local time like this:

public class DateTimeAutoMapperResolver : AutoMapper.ITypeConverter<DateTime, DateTime>
    {
        public DateTime Convert(DateTime source, DateTime destination, ResolutionContext context)
        {
            destination = DateTime.SpecifyKind(new DateTime(source.Ticks), DateTimeKind.Local);
            return destination;
        }
    }

Even with this, the dates come back converted to UTC time. I cannot find a setting to stop it from doing this. I do not want AutoMapper to modify DateTimes.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lbargaoanucommented, Apr 5, 2017

I don’t see it.

0reactions
lock[bot]commented, May 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Datetime timezone conversion issue in Typescript
I have picked a date from matDatePIcker in angular and passed that to the cloud application. But the DateTime is then converted based...
Read more >
Timezone issues when storing datetime attributes.
I'm having an issue with storing and retrieving date time fields. This probably has something to do with the new Laravel 7 date...
Read more >
Sharepoint DateTime Timezone Issues
Hi! I'm having an issue with a SharePoint list that uses datetime across different time zones. This column is really only needed for...
Read more >
A DateTime and time zone issue that may surprise you
I was working with a third-party API, and had to specify a date range object, with a start and date. The problem was,...
Read more >
Working with dates and timezones in JavaScript: a survival ...
A helpful primer for working with dates and timezones in Javascript. ... Nor are date and timezone problems the sort of issue that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found