I am trying to change date entered by user to different timezone. Right now it only for default value. But I want to change the date which will be entered by user in React Sharepoint Framework SPFx

<select onChange={this.submit}>
      <option value="-4">Virginia</option>
      <option value="-7">California</option>
      <option value="-4">New York</option>
      <option value="-4">Georgia</option>

<DateTimePicker placeholder={Date()} label="DateTime Picker - 12h" dateConvention={DateConvention.DateTime} value={this.state.temp} onChange={this.dateChange}/>
submit = (event) => {
var dt = new Date();
var utc = dt.getTime() + (dt.getTimezoneOffset() * 60000);
var fdt = new Date(utc + (3600000 * event.target.value));
console.log("Time: " + fdt.toLocaleString());
  • Where can I find the DateTimePicker component?Anf you want to get the date value entered by user?
    – Amos
    Oct 22 '20 at 8:31
  • Yes, in react spfx and there are few additional things I want to add like disabling Weekend and highlighting modified value. Oct 22 '20 at 12:14
  • I got this DateTimePicker component from pnp spfx controls react Oct 22 '20 at 12:15
  • It seems that this component can not disable weekend.There is no property about this.You can refer to official document:pnp.github.io/sp-dev-fx-controls-react/controls/DateTimePicker
    – Amos
    Oct 23 '20 at 8:52
  • Ohk thanks.....then I must use another date-time picker Oct 23 '20 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.