SwiftDate icon indicating copy to clipboard operation
SwiftDate copied to clipboard

Date locale is fine but Date() provides an offset of 8 hours.

Open gorbat-o opened this issue 5 years ago • 1 comments

Hi,

I am trying to have the exact date. When I print this Date().description(with: .current) it will show in the console this "Saturday, November 16, 2019 at 1:10:12 AM Pacific Standard Time" but if I print the following:

{abs_date='2019-11-16T09:12:51Z', rep_date='2019-11-16T01:12:51-08:00', region={calendar='gregorian', timezone='America/Los_Angeles', locale='en_US'}
  ▿ date : 2019-11-16 09:12:51 +0000
    - timeIntervalSinceReferenceDate : 595588371.396397
  ▿ region : {calendar='gregorian', timezone='America/Los_Angeles', locale='en_US'}
    ▿ calendar : gregorian (current)
      - identifier : gregorian
      - kind : "current"
      ▿ locale : Optional<Locale>
        ▿ some : en_US (current)
          - identifier : "en_US"
          - kind : "current"
      ▿ timeZone : America/Los_Angeles (current)
        - identifier : "America/Los_Angeles"
        - kind : "current"
        ▿ abbreviation : Optional<String>
          - some : "PST"
        - secondsFromGMT : -28800
        - isDaylightSavingTime : false
      - firstWeekday : 1
      - minimumDaysInFirstWeek : 1
  - customFormatter : nil

The data is correct, except the time, it is 1:13 am right now, not 9:13 am.

Please, what is the step to use the date correctly?

Thank you!

gorbat-o avatar Nov 16 '19 09:11 gorbat-o

Same question here. What's going on?

Sam-Spencer avatar Jun 29 '21 21:06 Sam-Spencer