Comments (4)
This is roughly 75% of the code of the library, it has days of the week and time but also time range, day ranges, exceptions that can be defined by multiple formats of date (on exact year or on every year), filters, it has options such as the timezone, the overflow to allow a range to overlap on the next day (night opening).
These are some good points, we only use a relatively small subset of the library on the frontend. Basically only timeranges and exceptions, we handle timezones in our own heavily convoluted way (which is why I thought it'd be nice to formalize it!)
I don't have the time to author a feature-rich library, and the company I work for won't be able to sponsor it for sure.
That being said, we do rely on these features in our frontend to an extent, and we do use Spatie libraries extensively (and I use them in my own projects too) so I am willing to spend some time on this.
I think it's best to gauge what kind of demand there is at all for this, and if it is the case that more businesses want this I do think I'd be willing to be involved in a collaborative effort.
About the purpose being generic enough: implementing only 1 or 2 methods is not decreasing significantly the complexity of the task, and if choosing to implement only some part of the format but not all, some of the options but not all and some of the methods but not all, it would just sound like an unrelated library and I think (but it's pure guessing) it would not be a lot of demand.
Given that we kinda have this in our codebase already anyway, I might as well just refactor it out into its own package when I'm working on related tickets to clean up our codebase. It could act as a starting point for developing a more fully-featured library.
from opening-hours.
Hello.
I don't see how it could be "a small drop-in supplement", reading your message sounds to me like you're asking the whole library to be rewritten in JavaScript so it can be used browser-side also. The idea is interesting but IMO it should not spatie/opening-hours
library responsibility, It should be a separated repo provide some npm package which can be maintained autonomously from the PHP package.
from opening-hours.
I'm not asking for the whole library to be rewritten. To be clearer, I'd like a small client-side library that understands the spatie-openinghours format to support the isOpen()
and isOpenAt(date: Date)
functions.
I don't think this is a big undertaking, and since I'm the first one even asking for it I don't think there's a lot of demand for all the other functionality. Additionally, once I get the the part where I have to formalize our own code a bit further, I'm offering my time to implement such a minimal supplementing package for this repository myself.
I opened the issue to discuss whether such a package is desirable at all, and what should be in it, and if there are any pitfalls to watch out for if it's desirable to release it to the general public (such as: should it support alternative date/time packages such as moment.js and date-fns?)
from opening-hours.
I'm offering my time to implement such a minimal supplementing package for this repository myself.
This is very kind of you. 🙏
I still prefer to warn about the seemingly small size of this task.
understands the spatie-opening/hours format
This is roughly 75% of the code of the library, it has days of the week and time but also time range, day ranges, exceptions that can be defined by multiple formats of date (on exact year or on every year), filters, it has options such as the timezone, the overflow to allow a range to overlap on the next day (night opening).
About the purpose being generic enough: implementing only 1 or 2 methods is not decreasing significantly the complexity of the task, and if choosing to implement only some part of the format but not all, some of the options but not all and some of the methods but not all, it would just sound like an unrelated library and I think (but it's pure guessing) it would not be a lot of demand.
However I can completely understand it could be enough for some businesses.
Having a full JS equivalent of the library however could interest way more people but that might be tedious. Depends how much spare time you have available (or if you know companies interested in that may sponsor the development of such a library).
I would definitely support an initiative from any developer willing to build a JS library that can interact in a compatible manner with this library and I would probably give a hand.
from opening-hours.
Related Issues (20)
- [Question/Feature Request] How to get all days of the current week including days resulting from exceptions? HOT 3
- [Bug] nextOpen calculates the wrong date for a regular day with exceptions HOT 3
- timezone is set on passed object when getting hours for a specific date HOT 2
- Free time slots during the day ? HOT 1
- nextOpen not respecting timezone HOT 2
- Timezone not working in currentOpenRange HOT 2
- I want to add schedule for specific date HOT 1
- Locale? HOT 1
- GitHub repository link not working HOT 2
- Support for holidays HOT 5
- Overflow support does not seem to work for createAndMergeOverlappingRanges HOT 2
- diffInOpenMinutes() does not work if only one day is configured as open HOT 6
- Date period in exceptions or start and end date for a set of days of the week in regular time HOT 4
- Exceptions with date ranges HOT 5
- [Feature request] createFromStructuredData method
- How to destroy OpeningHours object or update it ? HOT 1
- How to create an exception using datetime with seconds HOT 2
- Adding seconds precision to exceptions HOT 2
- Output time zone taken into account in all methods? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opening-hours.