Giter VIP home page Giter VIP logo

Comments (4)

DDSmileyIII avatar DDSmileyIII commented on August 16, 2024

I'm trying to understand the intended result of the rule in your code.

Rules inside a moment().recur function, as you have above, are applied when recurring dates are generated. It is an alternate syntax to the .every() style. See jsFiddle.

from moment-recur.

poing avatar poing commented on August 16, 2024

I am trying to change the daysOfWeek rule, adapting it to my dataset.
The source data uses Sunday = 1.

Check out this jsFiddle for a better idea of what I am trying to do.

from moment-recur.

DDSmileyIII avatar DDSmileyIII commented on August 16, 2024

@poing: Thanks for the additional details.

I don't see a way to customize moment-recur in this way. (I am not the ultimate authority, but that's what I have determined.)

However, you may be able to get what you need by a customization of the underlying moment functionality. The default is for weekdays to start with Sunday. The code below will change this so that the weekdays start on Saturday.

moment.updateLocale('en', {
weekdays : [
"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"
]
});

Another fiddle

from moment-recur.

poing avatar poing commented on August 16, 2024

@CorasApps thanks for the work-around. The jsFiddle was just a rough prototype, to give an idea of what I was looking for. Since the work-around is just a cosmetic fix, it doesn't work for my actual needs. It doesn't actually affect the underlying dates.

After digging through the code, it appears possible to set Calendar.ranges() with a rule. But createCalendarRule() implicitly prevents a new setting. The new range must match the hard-coded value. It's even verified against moment() to insure validity.

Looks like my only option is to iterate through the values to normalize my data with daysOfWeek. -or- Try to get the software vendor to represent daysOfWeek correctly.

Thank You

from moment-recur.

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.