sharepoint online – programmatically changing a date field

I have a form / web part where the user can edit columns. It works, but if the user needs to change the value in a date column, it will not work.

First, I have the input form:

  this.setDate(value)}
              isMonthPickerVisible={false}
        />

The value sends back to a function that saves it in a state with the type "Date":

public setDate = e => this.setState({ changeDate: e});

I then try to pass it to the list with the following function:

 if (this.state.changeDate) {

      eventList.items   //my list
        .getById(this.props.item.ID)
    .get()
    .then(async item => {
      eventList.items
        .getById(this.props.item.ID)

        .validateUpdateListItem((
          {
            FieldName: "EventDate",
            FieldValue: JSON.stringify(this.state.changeDate)
          }
        ))

        .then(result => {
          this.props.handleToUpdate();
        });
    });
}

It does not work and the column is not updated with the new values. Why is not the column being updated with the value from the status?

2d – MatterJS trigger input programmatically on server side

So I want to create a simple multiplayer game with MatterJS.

The game is basically, you have a slingshot and a ball, you pull the ball and when you let go of the ball, it flies (like Angry Birds basically).

If this is client-side only, it's easy to add mouseConstraint but I want to do the physics on the server side (NodeJS).

My question is, if I send the current inputs to the server, I can simulate the mouse click / drag only programmatically.

P.S. If it is not possible, or if it is just a silly approach, I welcome critics, or perhaps a suggestion, to use a different library.

sharepoint online – Programmatically create and add owners and members to the O365 group. No e-mails will be sent

I am using the code from OfficeDevPnP.Core to create a new UnifiedGroup. UnifiedGroupsUtitlity.CreateUnifiedGroup. My code is below.

UnifiedGroupsUtility.CreateUnifiedGroup("CSOM Site Creation",
                                                            "My Site Created in Code,
                                                            CSOM,
                                                            accessToken,
                                                            groupLogo: null,
                                                            owners: owners.ToArray(),
                                                            members: members.ToArray(),
                                                            isPrivate: true,
                                                            createTeam: false);

When I use this code, none of the owners or members receive an email stating that they have joined the group, as if I manually add them to a group.

Do I have to write this part of the code to send the emails, or is there another method that I can use to send the same template that Microsoft sends?

magento2.3 – Magento 2 Programmatically set the shipping method

I try to set the shipping method programmatically, but get the following error.
The shipping method is missing. Select the shipping method and try again.

foreach ($quote->getAllAddresses() as $address) {
            // Build grand total.
        $grandTotal = (($finalPrice + $shipping + $tax) - $discount);
        $baseGrandTotal =  $this->convertPrice($grandTotal);
        $baseFinalPrice =  $this->convertPrice($finalPrice);
        $baseDiscount =  $this->convertPrice($discount);
        $baseTax =  $this->convertPrice($tax);

        //$address->setFreeShipping(true); //tried this but not getting set

        $address->setShippingMethod('flatrate_flatrate'); //tried this getting error
        $address->setCollectShippingRates(true);


        $address->setBaseSubtotal($baseFinalPrice);
        $address->setSubtotal($finalPrice);
        $address->setDiscountAmount($discount);
        $address->setBaseDiscountAmount($baseDiscount);
        $address->setTaxAmount($tax);
        $address->setBaseTaxAmount($baseTax);
        $address->setBaseGrandTotal($baseGrandTotal);
        $address->setGrandTotal($grandTotal);
        $address->save();

}

sharepoint online – allow the current user to programmatically assign a list item

I'm creating an event webpart associated with a list of items. When a user participates in an event, a JSON object is parsed into a TXT document attached to that particular list item / event. with the user details. However, if a user does not have edit permission, it will not work. In that case, I want to give the user edit permissions. I use sharepoint online.

I thought about using the REST API to change the user permissions for that particular list item, but as far as I can grasp it, it seems that it only works for group permissions, and not the current user. Did I miss something or do I have to use a different method?

cookies – WooCommerce – Programmatically change the tax code in all areas

I'm trying to set a check box that will allow my site visitors to change the tax rate that they have to pay in WooCommerce (version 3.6.4).

I've set up a custom plug-in that detects if the tax rate has changed, and then updates the tax class used. This is maintained by the use of an additional cookie. It works well, but in two areas, the price of a page reload is always outdated.

On the shopping cart page, when you submit the form, you will see a form (with just a select and a submit button) sending these POSTs to the same URL and setting the cookie and tax code using some filters. Here's the code that does this (a bit chaotic and verbose):

setCookie();

        $this->addActions();

        $this->addFilters();
    }

    private function addActions()
    {
        add_action("init", ($this, 'setCookie'));
    }

    public function setCookie()
    {
        if($_POST('tax-rate') == "wholesale")
        {
            setcookie("tax-rate", "wholesale", time() + (86400 * 365), "/");

            $_COOKIE('tax-rate') = "wholesale";
        }
        else if($_POST('tax-rate') == "standard")
        {
            setcookie("tax-rate", "standard", time() + (86400 * 365), "/");

            $_COOKIE('tax-rate') = "standard";
        }
        else if(!isset($_COOKIE('tax-rate')))
        {
            setcookie("tax-rate", "standard", time() + (86400 * 365), "/");

            $_COOKIE('tax-rate') = "standard";
        }
    }

    private function addFilters()
    {
        add_filter("woocommerce_product_get_tax_class", ($this, 'setTaxRate'), 1, 2);
        add_filter("woocommerce_product_variation_get_tax_class", ($this, 'setTaxRate'), 1, 2);
    }

    public function setTaxRate($tax_class, $product)
    {
        if($_COOKIE('tax-rate') == "wholesale")
        {
            return "Wholesale";
        }

        return "";
    }
}

When the shopping cart page is reloaded, the prices in the table are updated. However, the header displays the subtotal but the old amount (using the default tax class). When I refresh or reload the page, the new amount (using the selected tax code) is displayed.

I can not figure out why this is the case, though I suspect it's the cookie and the use of the filters that receive the tax code. Even after a little digging, the cartsum in the header looks like it would get_cart_subtotal in that WC_Cart Class.

Thank you in advance!