Giter Site home page Giter Site logo

Date parsing error about wallpapper HOT 6 OPEN

VictorPuga avatar VictorPuga commented on May 21, 2024
Date parsing error

from wallpapper.

Comments (6)

VictorPuga avatar VictorPuga commented on May 21, 2024

Im using v1.7.1

from wallpapper.

mczachurski avatar mczachurski commented on May 21, 2024

Unfortunately I cannot reproduce that bug. I'm using below JSON and everything is working. Can you provide more information (full log, swift version, os version etc.)?

[
    {
        "fileName": "1.png",
        "isPrimary": true,
        "time": "2021-02-17T04:00:00Z"
    },
    {
        "fileName": "2.png",
        "time": "2021-02-17T05:00:00Z"
    },
    {
        "fileName": "3.png",
        "time": "2021-02-17T06:00:00Z"
    },
    {
        "fileName": "4.png",
        "time": "2021-02-17T07:00:00Z"
    },
    {
        "fileName": "5.png",
        "time": "2021-02-17T08:00:00Z"
    },
    {
        "fileName": "6.png",
        "time": "2021-02-17T10:00:00Z"
    },
    {
        "fileName": "7.png",
        "time": "2021-02-17T12:00:00Z"
    },
    {
        "fileName": "8.png",
        "time": "2021-02-17T13:00:00Z"
    },
    {
        "fileName": "8.png",
        "time": "2021-02-17T15:00:00Z"
    },
    {
        "fileName": "9.png",
        "time": "2021-02-17T16:00:00Z"
    },
    {
        "fileName": "10.png",
        "time": "2021-02-17T17:00:00Z"
    },
    {
        "fileName": "11.png",
        "time": "2021-02-17T18:00:00Z"
    },
    {
        "fileName": "12.png",
        "time": "2021-02-17T19:00:00Z"
    },
    {
        "fileName": "13.png",
        "time": "2021-02-17T20:00:00Z"
    },
    {
        "fileName": "14.png",
        "time": "2021-02-17T21:00:00Z"
    },
    {
        "fileName": "15.png",
        "time": "2021-02-17T22:00:00Z"
    },
    {
        "fileName": "16.png",
        "time": "2021-02-17T23:00:00Z"
    }
]

from wallpapper.

VictorPuga avatar VictorPuga commented on May 21, 2024

Same issue with the JSON above. I will try to provide some information

  • OS: macOS 11.2.1 (M1 Mac)
  • Instalation: Homebrew
  • wallpapper version: 1.7.1
  • swiftc version: Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28) Target: arm64-apple-darwin20.3.0
  • Log:
Reading JSON file: 'file:///Users/(...)/sample.json'...OK.
Decoding JSON file...Error: Unexpected error occurs: 
dataCorrupted(Swift.DecodingError.Context(codingPath: [_JSONKey(stringValue: "Index 7", intValue: 7), 
CodingKeys(stringValue: "time", intValue: nil)], debugDescription: "Date string does not match format 
expected by formatter.", underlyingError: nil))
  • JSON file: example from above

from wallpapper.

y-neck avatar y-neck commented on May 21, 2024

I have got exactly the same problem (same error log).

from wallpapper.

eduarbo avatar eduarbo commented on May 21, 2024

I had the same issue, apparently the parser breaks when you set the time format to 12-Hour in System Preferences. As a workaround try enabling the 24-Hour format temporarily while running the command.

Screen Shot 2021-10-11 at 8 04 46 p m

from wallpapper.

patrickhoette avatar patrickhoette commented on May 21, 2024

I solved this issue by changing line 40 of Program.swift to:

formatter.dateFormat = "hh:mm a"

and then used the following in my JSON:

[
    {
        "fileName": "light.jpg",
        "isPrimary": true,
        "isForLight": true,
        "time": "08:30 AM"
    },
    {
        "fileName": "dark.jpg",
        "isForDark": true,
        "time": "06:00 PM"
    }
]

This doesn't fundamentally fix the issue though, this just made it work with 12h formatted time. In case anyone is interested in a more permanent fix to the issue. This will mean making the change yourself and compiling the code but thats simple enough. Instructions are in the readme.

from wallpapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.