URL scheme for opening native calendar with specific date

前端 未结 4 2044
天命终不由人
天命终不由人 2020-12-09 17:51

I have found the sample code to open calendar from my app, but i can\'t open at a specific date.

NSString* launchUrl = @\"calshow://\";
[[UIApplication share         


        
4条回答
  •  生来不讨喜
    2020-12-09 18:14

    For react native with momentjs:

    const testDate = moment('2020–04–01'),      // date is local time
      referenceDate = moment.utc('2001–01-01'), // reference date is utc
      seconds = testDate.unix() — referenceDate.unix();
    Linking.openURL('calshow:' + seconds); //opens cal to April 1 2020
    

    https://medium.com/@duhseekoh/need-to-open-the-os-calendar-at-a-specific-date-in-react-native-55f3a085cf8e

提交回复
热议问题