Code Monkey home page Code Monkey logo

Comments (9)

fabian avatar fabian commented on July 17, 2024

Hmm, yes I guess adding a flag is better than adding a second time parameter like departureTime, as that's how it usually will be used.

How about timeType with values departure and arrival?

from transport.

1tchy avatar 1tchy commented on July 17, 2024

I think passing a parameter isDepartureTime=0 is clear to be the arrival time. And isDepartureTime=1 is clear to be the departure.

from transport.

colinfrei avatar colinfrei commented on July 17, 2024

I'd rather name the argument so that it's clear instead of adding an additional parameter.

So have a departuretime and an arrivaltime argument, and throw a 400 error if you get both.

from transport.

benib avatar benib commented on July 17, 2024

@colinfrei: this would mean we have depdate, deptime, arrdate and arrtime.
I think a parameter isArrivalTime would be the best, as this defaults to 0.

from transport.

colinfrei avatar colinfrei commented on July 17, 2024

The downside is that it makes it more magic. in my eyes arguments of which it's obvious what they do are always better than arguments where it's not obvious, even if that means having more arguments.

For example you'd still have the situation where it is like it is now, and you're not sure if arrival or departure is meant.

from transport.

benib avatar benib commented on July 17, 2024

I agree about the magic but i think that in this case, it would be easier for everybody to have some magic.
Think about a simple form where you can set the date/time and select departure or arrival (as the sbb.ch form). then you can handle the date/time the same way, and just add the isArrivalTime if arrival is selected.
Thats also the way, the xmlfahrplan API handles this, so we don't have to fiddle around internally.

Defaulting to departure is the way every fahrplan application handles this. so this is clear for me.

from transport.

1tchy avatar 1tchy commented on July 17, 2024

Whether the parameter is an isArrivalTime or isDepartureTime doesn't really matter for me. However, I agree with benib that there should be one extra parameter and not two changed and two invented ones. And I agree, it should default to departure. So it's indeed smarter to have the default isArrivalTime=0.

from transport.

akuendig avatar akuendig commented on July 17, 2024

+1 This would be a great addition

from transport.

fabian avatar fabian commented on July 17, 2024

PR merged.

from transport.

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.