upcal

Upcal - Myanmar Uposatha calendar and dawn time

1. Info

Upcal has has three variants: HTML, Android app, and iOS widget (via Scriptable app).

  1. 🌅 upCal HTML

  2. 🌅 upCal Android app Download APK from upCal Android releases

  3. 🌅 iOS widget read instructions

Functions

iOS widget screenshots

Upcal_Uposatha_Calendar_IOS

Whole Year Uposatha Calendar

Android and HTML screenshots

Main screen on Android: Upcal_Uposatha_Calendar_HTML

Dawn-rise time table for a whole month: Upcal_Uposatha_Calendar_HTML


2. iOS/iPadOS Widget Instructions (for iOS version >= 14 only)

1. Install Scriptable

Scriptable app by Simon Støvring from App Store.

(Note: iOS/iPadOS widget is only available for iOS/iPadOS version >=14)

  1. Select and Copy the below code:

const gitURL = "https://vpnry.github.io/upcal/Upcal_Module.js";
const widgetName = "Upcal_Widget.js";
const moduleName = "Upcal_Module.js";
const jsonParsePoint = "u@pc@l";

let fm = FileManager.local();
const is_iCloud = fm.isFileStoredIniCloud(module.filename);
fm = is_iCloud ? FileManager.iCloud() : fm;

let filename = fm.fileName(module.filename, true);
if (filename != widgetName) {
  let newPath = fm.joinPath(fm.documentsDirectory(), widgetName);
  let str = fm.readString(module.filename);
  fm.writeString(newPath, str.trim());
  fm.remove(module.filename);
}
let modulePath = fm.joinPath(fm.documentsDirectory(), moduleName);
if (!fm.fileExists(modulePath)) {
  console.log(moduleName + " is not exist. Trying to download it from git.")
  let str = "";
  try {
    let r = new Request(gitURL);
    str = await r.loadString();
  } catch (e) {
    console.log("Error when trying to download module file:\n" +
      gitURL + "\n" + e);
    return;
  }
  if (str.indexOf(jsonParsePoint) > 0) {
    fm.writeString(modulePath, str);
  } else {
    console.log("Incompatible "+ moduleName +" file. Check!");
    return;
  }
}
// Must await & invoke app.init(fm) first
let app = await importModule(modulePath);
await app.init(fm);
if (config.runsInWidget) {
  let widget = await app.createUpCalWidget();
  Script.setWidget(widget);
} else { console.log(app.settings);
  await app.selectTask(); }

Script.complete();


  1. Click this URLScheme to open Scriptable app and Paste the above code. Pls do not click on the Play ▶️ icon to run it yet. (So that the script will be renamed properly in step 3 below).
  2. Tap Done on the top left corner of Scriptable app to save it.
  3. In Scriptable main screen, tap on the script file you have just created to run it (normally it will be automatically named with a prefix as Untitled Script ).
  4. It will auto create a new file named Upcal_Widget and download Upcal_Module from this git server.
  5. Follow its instructions to do location setup for dawn time calculation [or skip and do later].
  6. Close Scriptable app, then add a Scriptable widget (and select the script file Upcal_Widget).

If you do not know how to add a Scriptable widget to your device home screen, try reading 4. How to add a widget to home screen on iOS/iPadOS (ver >=14) or do a search on the Internet.

2. Quick intro to Scriptable app

If you haven’t used Scriptable app before, here is a quick guide:

3. Update Latitude and Longitude

Dawn time calculation function needs location data. You can use GPS to automatically update location data or fill in manually:

Fill in location manually

Use GPS to automatically fill in location data

Notes:

If you get errors related to location, see Troubleshooting session below.

Auto update location

If it detects your location successfully! Congrats!

4. How to add a widget to home screen on iOS/iPadOS (ver >=14)

For this thing, you can search more on the Internet. One way to do is, from an iPad/iPhone home screen:


Script field: select **Upcal_Widget**
When Interacting: choose **Run Script**

The option When Interacting: Run Script will allow you to click on the widget to run Upcal in app directly.

5. Troubleshooting

5.1 Scriptable cannot detect your location

If the following error occurs when Scriptable app is trying to get location data, something like:

 'kCLErrorDomain error 0.' occurs:

To fix this error and other possible errors related to fetching GPS data, you may try:

These issues may likely happen if you did not use or turn on Location service on your iPhone/iPad for a long time.

5.2 I have updated my location why the widget is still showing the same values?

You may try these tips:

5.3 The formulas for dawn time calculation

5.4 Show|hide Nautical & Civil dawn info on the widget

There is an interesting research book Dawn (aruṇa) and Dawnrise (aruṇuggamana) in the Pāḷi Text:


When Is Dawn (aruṇa)? When Is Dawnrise (aruṇuggamana)?
Research on Dawn (aruṇa) and Dawnrise (aruṇuggamana) in the Pāḷi Text  with Photographs and Scientific Explanations 
by Bhikkhu Ñāṇadassana

8. Notes:

9. Open Source Libraries Acknowledgements

10. Feedback